if (99 == strlen (section))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer '%s`\n", section);
- GNUNET_HashCode h;
+ struct GNUNET_HashCode h;
int res = GNUNET_CRYPTO_hash_from_string (section, &h);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "HASH '%s` %i\n", GNUNET_h2s (&h), res);
* @return GNUNET_OK (continue to iterate)
*/
static int
-update_bw_simple_it (void *cls, const GNUNET_HashCode * key, void *value)
+update_bw_simple_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ATS_Address *aa = value;
static int
-compare_address_it (void *cls, const GNUNET_HashCode * key, void *value)
+compare_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct CompareAddressContext *cac = cls;
struct ATS_Address *aa = value;
static int
-compare_address_session_it (void *cls, const GNUNET_HashCode * key, void *value)
+compare_address_session_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct CompareAddressContext *cac = cls;
struct ATS_Address *aa = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-destroy_by_session_id (void *cls, const GNUNET_HashCode * key, void *value)
+destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct ATS_Address *info = cls;
struct ATS_Address *aa = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-find_address_it (void *cls, const GNUNET_HashCode * key, void *value)
+find_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ATS_Address **ap = cls;
struct ATS_Address *aa = (struct ATS_Address *) value;
static int
-reset_address_it (void *cls, const GNUNET_HashCode * key, void *value)
+reset_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ATS_Address *aa = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_address_it (void *cls, const GNUNET_HashCode * key, void *value)
+free_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ATS_Address *aa = value;
* @return GNUNET_OK to continue
*/
static int
-create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
+create_constraint_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GAS_MLP_Handle *mlp = cls;
struct ATS_Address *address = value;
* @return GNUNET_OK to continue
*/
static int
-create_columns_it (void *cls, const GNUNET_HashCode * key, void *value)
+create_columns_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GAS_MLP_Handle *mlp = cls;
struct ATS_Address *address = value;
}
static int
-mlp_get_preferred_address_it (void *cls, const GNUNET_HashCode * key, void *value)
+mlp_get_preferred_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ATS_PreferedAddress *aa = (struct ATS_PreferedAddress *) cls;
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_tracker (void *cls, const GNUNET_HashCode * key, void *value)
+free_tracker (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_BANDWIDTH_Tracker *tracker = value;
* @param hc where to store the result.
*/
void
-GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, uint32_t mingle_number,
- GNUNET_HashCode * hc)
+GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number,
+ struct GNUNET_HashCode * hc)
{
- GNUNET_HashCode m;
+ struct GNUNET_HashCode m;
GNUNET_CRYPTO_hash (&mingle_number, sizeof (uint32_t), &m);
GNUNET_CRYPTO_hash_xor (&m, in, hc);
enum GNUNET_BLOCK_EvaluationResult
GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
int
GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type, const void *block,
- size_t block_size, GNUNET_HashCode * key)
+ size_t block_size, struct GNUNET_HashCode * key)
{
struct GNUNET_BLOCK_PluginFunctions *plugin = find_plugin (ctx, type);
*/
struct GNUNET_CONTAINER_BloomFilter *
GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator,
- const GNUNET_HashCode * seen_results,
+ const struct GNUNET_HashCode * seen_results,
unsigned int seen_results_count)
{
struct GNUNET_CONTAINER_BloomFilter *bf;
- GNUNET_HashCode mhash;
+ struct GNUNET_HashCode mhash;
unsigned int i;
size_t nsize;
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_template_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
static int
block_plugin_template_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
return GNUNET_SYSERR;
}
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_test_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
size_t reply_block_size)
{
- GNUNET_HashCode chash;
- GNUNET_HashCode mhash;
+ struct GNUNET_HashCode chash;
+ struct GNUNET_HashCode mhash;
if (type != GNUNET_BLOCK_TYPE_TEST)
return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED;
static int
block_plugin_test_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
/* always fails since there is no fixed relationship between
* keys and values for test values */
static int
test_fs (struct GNUNET_BLOCK_Context *ctx)
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
char block[4];
memset (block, 1, sizeof (block));
/**
* Member ID (pseudonym).
*/
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
};
struct ReceiveNotificationMessage *received_msg;
struct ConfirmationReceiptMessage *receipt;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
- GNUNET_HashCode id;
- const GNUNET_HashCode *sender;
+ struct GNUNET_HashCode id;
+ const struct GNUNET_HashCode *sender;
struct GNUNET_CONTAINER_MetaData *meta;
struct GNUNET_CHAT_SendReceiptContext *src;
struct MemberList *pos;
prev = NULL;
pos = room->members;
while ((NULL != pos) &&
- (0 != memcmp (&pos->id, &id, sizeof (GNUNET_HashCode))))
+ (0 != memcmp (&pos->id, &id, sizeof (struct GNUNET_HashCode))))
{
prev = pos;
pos = pos->next;
while ((NULL != pos) &&
(0 !=
memcmp (&pos->id, &received_msg->sender,
- sizeof (GNUNET_HashCode))))
+ sizeof (struct GNUNET_HashCode))))
pos = pos->next;
GNUNET_assert (NULL != pos);
sender = &received_msg->sender;
GNUNET_CHAT_MemberListCallback memberCallback,
void *member_cls,
GNUNET_CHAT_MessageConfirmation confirmationCallback,
- void *confirmation_cls, GNUNET_HashCode * me)
+ void *confirmation_cls, struct GNUNET_HashCode * me)
{
struct GNUNET_CHAT_Room *chat_room;
struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
msg_to_send->reserved = htonl (0);
if (NULL == smc->receiver)
- memset (&msg_to_send->target, 0, sizeof (GNUNET_HashCode));
+ memset (&msg_to_send->target, 0, sizeof (struct GNUNET_HashCode));
else
GNUNET_CRYPTO_hash (smc->receiver,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
* Hash of the public key of the pseudonym of the sender of the message.
* Should be all zeros for anonymous.
*/
- GNUNET_HashCode sender;
+ struct GNUNET_HashCode sender;
/**
* The encrypted session key.
/**
* Who should receive this message? Set to all zeros for "everyone".
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
};
/**
* Who is confirming the receipt?
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
/**
* Who is the author of the chat message?
*/
- GNUNET_HashCode author;
+ struct GNUNET_HashCode author;
/**
* Hash of the (possibly encrypted) content.
*/
- GNUNET_HashCode content;
+ struct GNUNET_HashCode content;
};
* Hash of the public key of the pseudonym of the sender of the message
* Should be all zeros for anonymous.
*/
- GNUNET_HashCode sender;
+ struct GNUNET_HashCode sender;
/**
* Who should receive this message? Set to all zeros for "everyone".
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
/**
* The encrypted session key.
/**
* Who is confirming the receipt?
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
/**
* Who is the author of the chat message?
*/
- GNUNET_HashCode author;
+ struct GNUNET_HashCode author;
/**
* Hash of the (possibly encrypted) content.
*/
- GNUNET_HashCode content;
+ struct GNUNET_HashCode content;
};
GNUNET_NETWORK_STRUCT_END
*/
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
- const GNUNET_HashCode * sender,
+ const struct GNUNET_HashCode * sender,
const struct GNUNET_CONTAINER_MetaData *member_info,
const char *message, struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute timestamp,
- const GNUNET_HashCode * receiver)
+ const struct GNUNET_HashCode * receiver)
{
char *nick;
char *unique_nick;
char *nick;
char *non_unique_nick;
int nick_is_a_dup;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
struct UserList *pos;
struct UserList *prev;
{
char *my_name;
int my_name_is_a_dup;
- GNUNET_HashCode me;
+ struct GNUNET_HashCode me;
if (arg[0] == '#')
arg++; /* ignore first hash */
{
char *my_name;
int my_name_is_a_dup;
- GNUNET_HashCode me;
+ struct GNUNET_HashCode me;
GNUNET_CHAT_leave_room (room);
free_user_list ();
char *unique_name;
int name_is_a_dup;
struct UserList *pos;
- GNUNET_HashCode pid;
+ struct GNUNET_HashCode pid;
FPRINTF (stdout, _("Users in room `%s': "), room_name);
pos = users;
do_send_pm (const char *msg, const void *xtra)
{
char *user;
- GNUNET_HashCode uid;
- GNUNET_HashCode pid;
+ struct GNUNET_HashCode uid;
+ struct GNUNET_HashCode pid;
uint32_t seq;
struct UserList *pos;
GNUNET_CRYPTO_hash (&pos->pkey,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&pid);
- if (0 == memcmp (&pid, &uid, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&pid, &uid, sizeof (struct GNUNET_HashCode)))
break;
pos = pos->next;
}
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- GNUNET_HashCode me;
+ struct GNUNET_HashCode me;
char *my_name;
int my_name_is_a_dup;
/**
* Hash of the public key (for convenience).
*/
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
/**
* Options which the client is willing to receive.
/**
* Hash of the message.
*/
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
};
remember_anonymous_message (const struct P2PReceiveNotificationMessage
*p2p_rnmsg)
{
- static GNUNET_HashCode hash;
+ static struct GNUNET_HashCode hash;
struct AnonymousMessage *anon_msg;
struct AnonymousMessage *prev;
int anon_list_len;
static int
lookup_anonymous_message (const struct P2PReceiveNotificationMessage *p2p_rnmsg)
{
- static GNUNET_HashCode hash;
+ static struct GNUNET_HashCode hash;
struct AnonymousMessage *anon_msg;
GNUNET_CRYPTO_hash (p2p_rnmsg, ntohs (p2p_rnmsg->header.size), &hash);
anon_msg = anonymous_list_head;
while ((NULL != anon_msg) &&
- (0 != memcmp (&anon_msg->hash, &hash, sizeof (GNUNET_HashCode))))
+ (0 != memcmp (&anon_msg->hash, &hash, sizeof (struct GNUNET_HashCode))))
anon_msg = anon_msg->next;
return (NULL != anon_msg);
}
* Ask to send a message notification to the peer.
*/
static int
-send_message_noficiation (void *cls, const GNUNET_HashCode * key, void *value)
+send_message_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct P2PReceiveNotificationMessage *msg = cls;
struct ConnectedPeer *cp = value;
handle_transmit_request (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- static GNUNET_HashCode all_zeros;
+ static struct GNUNET_HashCode all_zeros;
const struct TransmitRequestMessage *trmsg;
struct ReceiveNotificationMessage *rnmsg;
struct P2PReceiveNotificationMessage *p2p_rnmsg;
is_anon = (0 != (ntohl (trmsg->msg_options) & GNUNET_CHAT_MSG_ANONYMOUS));
if (is_anon)
{
- memset (&rnmsg->sender, 0, sizeof (GNUNET_HashCode));
+ memset (&rnmsg->sender, 0, sizeof (struct GNUNET_HashCode));
rnmsg->sequence_number = 0;
}
else
"Encrypting the session key using the public key of '%s'\n",
GNUNET_h2s (&trmsg->target));
#endif
- if (0 == memcmp (&all_zeros, &trmsg->target, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&all_zeros, &trmsg->target, sizeof (struct GNUNET_HashCode)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed message: private, but no target\n");
target = client_list_head;
while ((NULL != target) &&
(0 !=
- memcmp (&target->id, &trmsg->target, sizeof (GNUNET_HashCode))))
+ memcmp (&target->id, &trmsg->target, sizeof (struct GNUNET_HashCode))))
target = target->next;
if (NULL == target)
{
(pos->client != client))
{
if (((!is_priv) ||
- (0 == memcmp (&trmsg->target, &pos->id, sizeof (GNUNET_HashCode))))
+ (0 == memcmp (&trmsg->target, &pos->id, sizeof (struct GNUNET_HashCode))))
&& (0 == (ntohl (trmsg->msg_options) & (~pos->msg_options))))
{
GNUNET_SERVER_notification_context_unicast (nc, pos->client,
* Ask to send a join notification to the peer.
*/
static int
-send_join_noficiation (void *cls, const GNUNET_HashCode * key, void *value)
+send_join_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ChatClient *entry = cls;
struct ConnectedPeer *cp = value;
* Ask to send a confirmation receipt to the peer.
*/
static int
-send_confirmation_receipt (void *cls, const GNUNET_HashCode * key, void *value)
+send_confirmation_receipt (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct P2PConfirmationReceiptMessage *receipt = cls;
struct ConnectedPeer *cp = value;
author = client_list_head;
while ((NULL != author) &&
(0 !=
- memcmp (&receipt->author, &author->id, sizeof (GNUNET_HashCode))))
+ memcmp (&receipt->author, &author->id, sizeof (struct GNUNET_HashCode))))
author = author->next;
if (NULL == author)
{
target = client_list_head;
while ((NULL != target) &&
(0 !=
- memcmp (&receipt->target, &target->id, sizeof (GNUNET_HashCode))))
+ memcmp (&receipt->target, &target->id, sizeof (struct GNUNET_HashCode))))
target = target->next;
if (NULL == target)
{
* Ask to send a leave notification to the peer.
*/
static int
-send_leave_noficiation (void *cls, const GNUNET_HashCode * key, void *value)
+send_leave_noficiation (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ChatClient *entry = cls;
struct ConnectedPeer *cp = value;
struct ChatClient *new_entry;
struct ChatClient *entry;
struct JoinNotificationMessage *jnmsg;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got P2P join notification\n");
if (ntohs (message->size) <= sizeof (struct P2PJoinNotificationMessage))
entry = client_list_head;
while (NULL != entry)
{
- if (0 == memcmp (&entry->id, &id, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&entry->id, &id, sizeof (struct GNUNET_HashCode)))
{
#if DEBUG_CHAT_SERVICE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
unsigned int atsi_count)
{
const struct P2PLeaveNotificationMessage *p2p_lnmsg;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
struct ChatClient *pos;
struct ChatClient *prev;
struct ChatClient *entry;
prev = NULL;
while (NULL != pos)
{
- if (0 == memcmp (&pos->id, &id, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&pos->id, &id, sizeof (struct GNUNET_HashCode)))
break;
prev = pos;
pos = pos->next;
struct ReceiveNotificationMessage *rnmsg;
struct ChatClient *sender;
struct ChatClient *pos;
- static GNUNET_HashCode all_zeros;
+ static struct GNUNET_HashCode all_zeros;
int is_priv;
int is_anon;
uint16_t msg_len;
sender = client_list_head;
while ((NULL != sender) &&
(0 !=
- memcmp (&sender->id, &p2p_rnmsg->sender, sizeof (GNUNET_HashCode))))
+ memcmp (&sender->id, &p2p_rnmsg->sender, sizeof (struct GNUNET_HashCode))))
sender = sender->next;
if (NULL == sender)
{
rnmsg->reserved = htonl (0);
rnmsg->timestamp = p2p_rnmsg->timestamp;
is_priv =
- (0 != memcmp (&all_zeros, &p2p_rnmsg->target, sizeof (GNUNET_HashCode)));
+ (0 != memcmp (&all_zeros, &p2p_rnmsg->target, sizeof (struct GNUNET_HashCode)));
if (is_priv)
memcpy (&rnmsg->encrypted_key, &p2p_rnmsg->encrypted_key,
sizeof (struct GNUNET_CRYPTO_RsaEncryptedData));
{
if (((!is_priv) ||
(0 ==
- memcmp (&p2p_rnmsg->target, &pos->id, sizeof (GNUNET_HashCode)))) &&
+ memcmp (&p2p_rnmsg->target, &pos->id, sizeof (struct GNUNET_HashCode)))) &&
(0 == (ntohl (p2p_rnmsg->msg_options) & (~pos->msg_options))))
{
GNUNET_SERVER_notification_context_unicast (nc, pos->client,
target = client_list_head;
while ((NULL != target) &&
(0 !=
- memcmp (&target->id, &p2p_crmsg->target, sizeof (GNUNET_HashCode))))
+ memcmp (&target->id, &p2p_crmsg->target, sizeof (struct GNUNET_HashCode))))
target = target->next;
if (NULL == target)
{
author = client_list_head;
while ((NULL != author) &&
(0 !=
- memcmp (&author->id, &p2p_crmsg->author, sizeof (GNUNET_HashCode))))
+ memcmp (&author->id, &p2p_crmsg->author, sizeof (struct GNUNET_HashCode))))
author = author->next;
if (NULL == author)
{
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-clean_peer (void *cls, const GNUNET_HashCode * key, void *value)
+clean_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ConnectedPeer *cp;
const struct GNUNET_PeerIdentity *peer =
return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer disconnected: %s\n",
GNUNET_i2s (peer));
- clean_peer (NULL, (const GNUNET_HashCode *) peer, NULL);
+ clean_peer (NULL, (const struct GNUNET_HashCode *) peer, NULL);
}
{
struct GNUNET_CONTAINER_MetaData *meta;
- GNUNET_HashCode *sender;
+ struct GNUNET_HashCode *sender;
char *msg;
static struct PeerContext p2;
-static GNUNET_HashCode alice;
+static struct GNUNET_HashCode alice;
-static GNUNET_HashCode bob;
+static struct GNUNET_HashCode bob;
static struct GNUNET_CHAT_Room *alice_room;
enum GNUNET_CHAT_MsgOptions options)
{
struct Wanted *want = cls;
- GNUNET_HashCode sender;
+ struct GNUNET_HashCode sender;
#if VERBOSE
printf ("%s - told that %s has %s\n", want->me,
GNUNET_CRYPTO_hash (member_id,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
- if ((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode))) &&
(((member_info == NULL) && (want->meta == NULL)) ||
((member_info != NULL) && (want->meta != NULL) &&
(GNUNET_CONTAINER_meta_data_test_equal (member_info, want->meta)))) &&
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
- const GNUNET_HashCode * sender,
+ const struct GNUNET_HashCode * sender,
const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
if ((0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
- (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (sender, want->sender, sizeof (struct GNUNET_HashCode))))) &&
(GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
(options == want->opt) &&
/* Not == since the library sets the actual timestamp, so it may be
confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute timestamp,
- const GNUNET_HashCode * receiver)
+ const struct GNUNET_HashCode * receiver)
{
struct Wanted *want = cls;
EXTRACTOR_METATYPE_TITLE),
orig_seq_number);
#endif
- if ((0 == memcmp (receiver, want->sender, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (receiver, want->sender, sizeof (struct GNUNET_HashCode))) &&
(orig_seq_number == want->sequence_number) &&
(timestamp.abs_value >= want->timestamp.abs_value))
{
{
struct GNUNET_CONTAINER_MetaData *meta;
- GNUNET_HashCode *sender;
+ struct GNUNET_HashCode *sender;
/**
* Alternative meta/sender is used when we expect join/leave notification
*/
struct GNUNET_CONTAINER_MetaData *meta2;
- GNUNET_HashCode *sender2;
+ struct GNUNET_HashCode *sender2;
char *msg;
static struct PeerContext p3;
-static GNUNET_HashCode alice;
+static struct GNUNET_HashCode alice;
-static GNUNET_HashCode bob;
+static struct GNUNET_HashCode bob;
-static GNUNET_HashCode carol;
+static struct GNUNET_HashCode carol;
static struct GNUNET_CHAT_Room *alice_room;
enum GNUNET_CHAT_MsgOptions options)
{
struct Wanted *want = cls;
- GNUNET_HashCode sender;
+ struct GNUNET_HashCode sender;
#if VERBOSE
printf ("%s - told that %s has %s\n", want->me,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
/* entertain both primary and an alternative sender/meta */
- if (((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) ||
+ if (((0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode))) ||
((want->sender2 != NULL) &&
- (0 == memcmp (&sender, want->sender2, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (&sender, want->sender2, sizeof (struct GNUNET_HashCode))))) &&
(((member_info == NULL) && (want->meta == NULL)) ||
((member_info != NULL) &&
(((want->meta != NULL) &&
{
/* remember Bob's public key, we need it to send private message */
if (NULL == bob_public_key &&
- (0 == memcmp (&bob, want->sender, sizeof (GNUNET_HashCode))))
+ (0 == memcmp (&bob, want->sender, sizeof (struct GNUNET_HashCode))))
bob_public_key =
GNUNET_memdup (member_id,
sizeof (struct
if (want->sender2 != NULL)
{
/* flush alternative sender */
- if (0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&sender, want->sender, sizeof (struct GNUNET_HashCode)))
{
want->sender = want->sender2;
want->meta = want->meta2;
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
- const GNUNET_HashCode * sender,
+ const struct GNUNET_HashCode * sender,
const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
if ((want->msg != NULL) && (0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
- (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (sender, want->sender, sizeof (struct GNUNET_HashCode))))) &&
(GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
(options == want->opt) &&
/* Not == since the library sets the actual timestamp, so it may be
* @return GNUNET_YES (continue)
*/
static int
-disconnect_and_free_peer_entry (void *cls, const GNUNET_HashCode * key,
+disconnect_and_free_peer_entry (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GNUNET_CORE_Handle *h = cls;
* @return GNUNET_YES (continue iteration)
*/
static int
-destroy_active_client_request (void *cls, const GNUNET_HashCode * key,
+destroy_active_client_request (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GSC_ClientActiveRequest *car = value;
* (excluding this value itself) will be encrypted and authenticated.
* ENCRYPTED_HEADER_SIZE must be set to the offset of the *next* field.
*/
- GNUNET_HashCode hmac;
+ struct GNUNET_HashCode hmac;
/**
* Sequence number, in network byte order. This field
{
const struct EncryptedMessage *m;
struct EncryptedMessage *pt; /* plaintext */
- GNUNET_HashCode ph;
+ struct GNUNET_HashCode ph;
uint32_t snum;
struct GNUNET_TIME_Absolute t;
struct GNUNET_CRYPTO_AesInitializationVector iv;
kx->decrypt_key_created);
GNUNET_CRYPTO_hmac (&auth_key, &m->sequence_number,
size - ENCRYPTED_HEADER_SIZE, &ph);
- if (0 != memcmp (&ph, &m->hmac, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&ph, &m->hmac, sizeof (struct GNUNET_HashCode)))
{
/* checksum failed */
GNUNET_break_op (0);
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_neighbour_helper (void *cls, const GNUNET_HashCode * key, void *value)
+free_neighbour_helper (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct Neighbour *n = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-notify_client_about_session (void *cls, const GNUNET_HashCode * key,
+notify_client_about_session (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GSC_Client *client = cls;
* @return always GNUNET_OK
*/
static int
-do_send_message (void *cls, const GNUNET_HashCode * key, void *value)
+do_send_message (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct GNUNET_MessageHeader *hdr = cls;
struct Session *session = value;
*/
#include "core.h"
static int
-queue_connect_message (void *cls, const GNUNET_HashCode * key, void *value)
+queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_SERVER_TransmitContext *tc = cls;
struct Session *session = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_session_helper (void *cls, const GNUNET_HashCode * key, void *value)
+free_session_helper (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct Session *session = value;
* @param size number of bytes that were made available
*/
static void
-env_delete_notify (void *cls, const GNUNET_HashCode * key, size_t size)
+env_delete_notify (void *cls, const struct GNUNET_HashCode * key, size_t size)
{
struct GNUNET_DATACACHE_Handle *h = cls;
*/
int
GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
*/
unsigned int
GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
- const GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls)
{
GNUNET_STATISTICS_update (h->stats, gettext_noop ("# requests received"), 1,
static int
checkIt (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key, size_t size, const char *data,
+ const struct GNUNET_HashCode * key, size_t size, const char *data,
enum GNUNET_BLOCK_Type type)
{
- if ((size == sizeof (GNUNET_HashCode)) && (0 == memcmp (data, cls, size)))
+ if ((size == sizeof (struct GNUNET_HashCode)) && (0 == memcmp (data, cls, size)))
found++;
return GNUNET_OK;
}
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
- GNUNET_HashCode k;
- GNUNET_HashCode n;
+ struct GNUNET_HashCode k;
+ struct GNUNET_HashCode n;
struct GNUNET_TIME_Absolute exp;
struct GNUNET_TIME_Absolute start;
unsigned int i;
}
exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
start = GNUNET_TIME_absolute_get ();
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < ITERATIONS; i++)
{
if (0 == i % (ITERATIONS / 80))
FPRINTF (stderr, "%s", ".");
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
ASSERT (GNUNET_OK ==
- GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
+ GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
(const char *) &n, 1 + i % 16, exp));
k = n;
}
GNUNET_TIME_absolute_get_duration (start).rel_value / ITERATIONS,
"ms/item");
start = GNUNET_TIME_absolute_get ();
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < ITERATIONS; i++)
{
if (0 == i % (ITERATIONS / 80))
FPRINTF (stderr, "%s", ".");
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n);
k = n;
}
/**
* Estimate of the per-entry overhead (including indices).
*/
-#define OVERHEAD ((4*2+4*2+8*2+8*2+sizeof(GNUNET_HashCode)*5+8))
+#define OVERHEAD ((4*2+4*2+8*2+8*2+sizeof(struct GNUNET_HashCode)*5+8))
/**
* Die with an error message that indicates
* @return 0 on error, number of bytes used otherwise
*/
static size_t
-mysql_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
+mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
unsigned long long v_now;
unsigned long long v_discard_time;
unsigned int v_type;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
int ret;
if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
now = GNUNET_TIME_absolute_get ();
/* first try UPDATE */
- h_length = sizeof (GNUNET_HashCode);
- k_length = sizeof (GNUNET_HashCode);
+ h_length = sizeof (struct GNUNET_HashCode);
+ k_length = sizeof (struct GNUNET_HashCode);
v_length = size;
v_type = type;
v_now = (unsigned long long) now.abs_value;
GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_value, NULL,
MYSQL_TYPE_LONGLONG, &v_now, GNUNET_YES,
MYSQL_TYPE_LONGLONG, &v_discard_time, GNUNET_YES,
- MYSQL_TYPE_BLOB, key, sizeof (GNUNET_HashCode),
+ MYSQL_TYPE_BLOB, key, sizeof (struct GNUNET_HashCode),
&k_length, MYSQL_TYPE_BLOB, &vhash,
- sizeof (GNUNET_HashCode), &h_length,
+ sizeof (struct GNUNET_HashCode), &h_length,
MYSQL_TYPE_LONG, &v_type, GNUNET_YES, -1))
return GNUNET_OK;
/* now try INSERT */
- h_length = sizeof (GNUNET_HashCode);
- k_length = sizeof (GNUNET_HashCode);
+ h_length = sizeof (struct GNUNET_HashCode);
+ k_length = sizeof (struct GNUNET_HashCode);
v_length = size;
if (GNUNET_OK !=
(ret =
MYSQL_TYPE_LONG, &type, GNUNET_YES,
MYSQL_TYPE_LONGLONG, &v_now, GNUNET_YES,
MYSQL_TYPE_LONGLONG, &v_discard_time, GNUNET_YES,
- MYSQL_TYPE_BLOB, key, sizeof (GNUNET_HashCode),
+ MYSQL_TYPE_BLOB, key, sizeof (struct GNUNET_HashCode),
&k_length, MYSQL_TYPE_BLOB, &vhash,
- sizeof (GNUNET_HashCode), &h_length,
+ sizeof (struct GNUNET_HashCode), &h_length,
MYSQL_TYPE_BLOB, data, (unsigned long) size,
&v_length, -1)))
{
* @return the number of results found
*/
static unsigned int
-mysql_plugin_get (void *cls, const GNUNET_HashCode * key,
+mysql_plugin_get (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter,
void *iter_cls)
{
char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE];
now = GNUNET_TIME_absolute_get ();
- h_length = sizeof (GNUNET_HashCode);
+ h_length = sizeof (struct GNUNET_HashCode);
v_length = sizeof (buffer);
total = -1;
memset (rbind, 0, sizeof (rbind));
(ret =
GNUNET_MYSQL_statement_run_prepared_select (plugin->mc, plugin->count_value, 1, rbind,
return_ok, NULL, MYSQL_TYPE_BLOB, key,
- sizeof (GNUNET_HashCode), &h_length,
+ sizeof (struct GNUNET_HashCode), &h_length,
MYSQL_TYPE_LONG, &v_type, GNUNET_YES,
MYSQL_TYPE_LONGLONG, &v_now, GNUNET_YES,
-1))) || (-1 == total))
(ret =
GNUNET_MYSQL_statement_run_prepared_select (plugin->mc, plugin->select_value, 2, rbind,
return_ok, NULL, MYSQL_TYPE_BLOB, key,
- sizeof (GNUNET_HashCode), &h_length,
+ sizeof (struct GNUNET_HashCode), &h_length,
MYSQL_TYPE_LONG, &v_type, GNUNET_YES,
MYSQL_TYPE_LONGLONG, &v_now, GNUNET_YES,
MYSQL_TYPE_LONG, &off, GNUNET_YES, -1)))
MYSQL_BIND rbind[5];
unsigned int v_type;
- GNUNET_HashCode v_key;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode v_key;
+ struct GNUNET_HashCode vhash;
unsigned long k_length;
unsigned long h_length;
unsigned long v_length;
int ret;
char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE];
- k_length = sizeof (GNUNET_HashCode);
- h_length = sizeof (GNUNET_HashCode);
+ k_length = sizeof (struct GNUNET_HashCode);
+ h_length = sizeof (struct GNUNET_HashCode);
v_length = sizeof (buffer);
memset (rbind, 0, sizeof (rbind));
rbind[0].buffer_type = MYSQL_TYPE_BLOB;
- rbind[0].buffer_length = sizeof (GNUNET_HashCode);
+ rbind[0].buffer_length = sizeof (struct GNUNET_HashCode);
rbind[0].length = &k_length;
rbind[0].buffer = &v_key;
rbind[1].buffer_type = MYSQL_TYPE_BLOB;
- rbind[1].buffer_length = sizeof (GNUNET_HashCode);
+ rbind[1].buffer_length = sizeof (struct GNUNET_HashCode);
rbind[1].length = &h_length;
rbind[1].buffer = &vhash;
rbind[2].buffer_type = MYSQL_TYPE_LONG;
(ret =
GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->delete_value, NULL,
MYSQL_TYPE_BLOB, &v_key,
- sizeof (GNUNET_HashCode), &k_length,
+ sizeof (struct GNUNET_HashCode), &k_length,
MYSQL_TYPE_BLOB, &vhash,
- sizeof (GNUNET_HashCode), &h_length,
+ sizeof (struct GNUNET_HashCode), &h_length,
MYSQL_TYPE_LONG, &v_type, GNUNET_YES,
MYSQL_TYPE_BLOB, buffer,
(unsigned long) sizeof (buffer), &v_length,
/**
* Per-entry overhead estimate
*/
-#define OVERHEAD (sizeof(GNUNET_HashCode) + 24)
+#define OVERHEAD (sizeof(struct GNUNET_HashCode) + 24)
/**
* Context for all functions in this plugin.
* @return 0 on error, number of bytes used otherwise
*/
static size_t
-postgres_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
+postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
int paramLengths[] = {
sizeof (btype),
sizeof (bexpi),
- sizeof (GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
size
};
const int paramFormats[] = { 1, 1, 1, 1 };
* @return the number of results found
*/
static unsigned int
-postgres_plugin_get (void *cls, const GNUNET_HashCode * key,
+postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls)
{
(const char *) &btype,
};
int paramLengths[] = {
- sizeof (GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
sizeof (btype),
};
const int paramFormats[] = { 1, 1 };
struct Plugin *plugin = cls;
uint32_t size;
uint32_t oid;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
PGresult *res;
res = PQexecPrepared (plugin->dbh, "getm", 0, NULL, NULL, NULL, 1);
}
if ((3 != PQnfields (res)) || (sizeof (size) != PQfsize (res, 0)) ||
(sizeof (oid) != PQfsize (res, 1)) ||
- (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 2)))
+ (sizeof (struct GNUNET_HashCode) != PQgetlength (res, 0, 2)))
{
GNUNET_break (0);
PQclear (res);
}
size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0));
oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1));
- memcpy (&key, PQgetvalue (res, 0, 2), sizeof (GNUNET_HashCode));
+ memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode));
PQclear (res);
if (GNUNET_OK != GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", oid))
return GNUNET_SYSERR;
* How much overhead do we assume per entry in the
* datacache?
*/
-#define OVERHEAD (sizeof(GNUNET_HashCode) + 32)
+#define OVERHEAD (sizeof(struct GNUNET_HashCode) + 32)
/**
* Context for all functions in this plugin.
* @return 0 on error, number of bytes used otherwise
*/
static size_t
-sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
+sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
if ((SQLITE_OK != sqlite3_bind_int (stmt, 1, type)) ||
(SQLITE_OK != sqlite3_bind_int64 (stmt, 2, dval)) ||
(SQLITE_OK !=
- sqlite3_bind_blob (stmt, 3, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 3, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK != sqlite3_bind_blob (stmt, 4, data, size, SQLITE_TRANSIENT)))
{
* @return the number of results found
*/
static unsigned int
-sqlite_plugin_get (void *cls, const GNUNET_HashCode * key,
+sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter,
void *iter_cls)
{
ntime = (int64_t) now.abs_value;
GNUNET_assert (ntime >= 0);
if ((SQLITE_OK !=
- sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
(SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value)))
return cnt;
}
if ((SQLITE_OK !=
- sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
(SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value)))
unsigned int dsize;
sqlite3_stmt *stmt;
sqlite3_stmt *dstmt;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s'\n", "DEL");
stmt = NULL;
return GNUNET_SYSERR;
}
rowid = sqlite3_column_int64 (stmt, 0);
- GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (GNUNET_HashCode));
- memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (GNUNET_HashCode));
+ GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode));
+ memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
dsize = sqlite3_column_bytes (stmt, 2);
if (SQLITE_OK != sqlite3_finalize (stmt))
LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
* @return 0 on error, number of bytes used otherwise
*/
static size_t
-template_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
+template_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
* @return the number of results found
*/
static unsigned int
-template_plugin_get (void *cls, const GNUNET_HashCode * key,
+template_plugin_get (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls)
{
static int
checkIt (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key, size_t size, const char *data,
+ const struct GNUNET_HashCode * key, size_t size, const char *data,
enum GNUNET_BLOCK_Type type)
{
- if (size != sizeof (GNUNET_HashCode))
+ if (size != sizeof (struct GNUNET_HashCode))
{
GNUNET_break (0);
ok = 2;
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
- GNUNET_HashCode k;
- GNUNET_HashCode n;
+ struct GNUNET_HashCode k;
+ struct GNUNET_HashCode n;
struct GNUNET_TIME_Absolute exp;
unsigned int i;
}
exp = GNUNET_TIME_absolute_get ();
exp.abs_value += 5 * 60 * 1000;
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < 100; i++)
{
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
ASSERT (GNUNET_OK ==
- GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
+ GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
(const char *) &n, 1 + i % 16, exp));
k = n;
}
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < 100; i++)
{
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
ASSERT (1 == GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n));
k = n;
}
- memset (&k, 42, sizeof (GNUNET_HashCode));
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ memset (&k, 42, sizeof (struct GNUNET_HashCode));
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
ASSERT (GNUNET_OK ==
- GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
+ GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
(const char *) &n, 792,
GNUNET_TIME_UNIT_FOREVER_ABS));
ASSERT (0 != GNUNET_DATACACHE_get (h, &k, 792, &checkIt, &n));
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
- GNUNET_HashCode k;
- GNUNET_HashCode n;
+ struct GNUNET_HashCode k;
+ struct GNUNET_HashCode n;
unsigned int i;
unsigned int j;
char buf[3200];
}
exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
memset (buf, 1, sizeof (buf));
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < 10; i++)
{
FPRINTF (stderr, "%s", ".");
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
for (j = i; j < sizeof (buf); j += 10)
{
exp.abs_value++;
k = n;
}
FPRINTF (stderr, "%s", "\n");
- memset (&k, 0, sizeof (GNUNET_HashCode));
+ memset (&k, 0, sizeof (struct GNUNET_HashCode));
for (i = 0; i < 10; i++)
{
FPRINTF (stderr, "%s", ".");
- GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
+ GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
if (i < 2)
ASSERT (0 == GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
if (i == 9)
/**
* Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET. Size
* can either be "sizeof(struct GetMessage)" or
- * "sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)"!
+ * "sizeof(struct GetMessage) - sizeof(struct GNUNET_HashCode)"!
*/
struct GNUNET_MessageHeader header;
* Desired key (optional). Check the "size" of the
* header to see if the key is actually present.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
/**
* Key under which the item can be found.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
GNUNET_NETWORK_STRUCT_END
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
uint32_t replication,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const void *data, unsigned int queue_priority,
unsigned int max_queue_size,
struct GNUNET_TIME_Relative timeout,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
unsigned int queue_priority,
unsigned int max_queue_size,
else
{
gm->header.size =
- htons (sizeof (struct GetMessage) - sizeof (GNUNET_HashCode));
+ htons (sizeof (struct GetMessage) - sizeof (struct GNUNET_HashCode));
}
process_queue (h);
return qe;
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-expired_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
+expired_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-quota_processor (void *cls, const GNUNET_HashCode * key, uint32_t size,
+quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-transmit_item (void *cls, const GNUNET_HashCode * key, uint32_t size,
+transmit_item (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
* GNUNET_NO to delete the item
*/
static int
-check_present (void *cls, const GNUNET_HashCode * key, uint32_t size,
+check_present (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
int rid;
struct ReservationList *pos;
struct PutContext *pc;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
uint32_t size;
if ((dm == NULL) || (ntohl (dm->type) == 0))
size = ntohs (message->size);
if ((size != sizeof (struct GetMessage)) &&
- (size != sizeof (struct GetMessage) - sizeof (GNUNET_HashCode)))
+ (size != sizeof (struct GetMessage) - sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
* in to be deleted (by returning GNUNET_NO).
*/
static int
-remove_callback (void *cls, const GNUNET_HashCode * key, uint32_t size,
+remove_callback (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
const struct GNUNET_MessageHeader *message)
{
const struct DataMessage *dm = check_data (message);
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
if (dm == NULL)
{
*/
static void
add_key_to_bloomfilter (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
unsigned int count)
{
struct GNUNET_CONTAINER_BloomFilter *bf = cls;
static void
-delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
+delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
{
struct CpsRunContext *crc = cls;
size_t size;
- static GNUNET_HashCode key;
+ static struct GNUNET_HashCode key;
static char data[65536];
int i;
int k;
switch (crc->phase)
{
case RP_PUT:
- memset (&key, 256 - crc->i, sizeof (GNUNET_HashCode));
+ memset (&key, 256 - crc->i, sizeof (struct GNUNET_HashCode));
i = crc->j;
k = crc->i;
/* most content is 32k */
if (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16) == 0) /* but some of it is less! */
size = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 32 * 1024);
crc->size = size = size - (size & 7); /* always multiple of 8 */
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
memset (data, i, size);
if (i > 255)
memset (data, i - 255, size / 2);
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
datastore = GNUNET_DATASTORE_connect (cfg);
start_time = GNUNET_TIME_absolute_get ();
{
char value[65536];
size_t size;
- static GNUNET_HashCode key;
+ static struct GNUNET_HashCode key;
static int ic;
char *msg;
unsigned int prio;
/* generate random key */
key.bits[0] = (unsigned int) GNUNET_TIME_absolute_get ().abs_value;
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &key);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &key);
memset (value, i, size);
if (i > 255)
memset (value, i - 255, size / 2);
static int
-iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size,
+iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
static int
-expiration_get (void *cls, const GNUNET_HashCode * key, uint32_t size,
+expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
static int
-replication_get (void *cls, const GNUNET_HashCode * key, uint32_t size,
+replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
* @return GNUNET_OK on success
*/
static int
-mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity, uint32_t replication,
struct GNUNET_TIME_Absolute expiration, char **msg)
unsigned long hashSize;
unsigned long hashSize2;
unsigned long lsize;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
if (size > MAX_DATUM_SIZE)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
- hashSize = sizeof (GNUNET_HashCode);
- hashSize2 = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
+ hashSize2 = sizeof (struct GNUNET_HashCode);
lsize = size;
GNUNET_CRYPTO_hash (data, size, &vhash);
if (GNUNET_OK !=
unsigned long size;
unsigned long long uid;
char value[GNUNET_DATASTORE_MAX_VALUE_SIZE];
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct GNUNET_TIME_Absolute expiration;
MYSQL_BIND rbind[7];
- hashSize = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
memset (rbind, 0, sizeof (rbind));
rbind[0].buffer_type = MYSQL_TYPE_LONG;
rbind[0].buffer = &type;
return;
}
GNUNET_assert (size <= sizeof (value));
- if ((rbind[4].buffer_length != sizeof (GNUNET_HashCode)) ||
- (hashSize != sizeof (GNUNET_HashCode)))
+ if ((rbind[4].buffer_length != sizeof (struct GNUNET_HashCode)) ||
+ (hashSize != sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
* @param proc_cls closure for proc
*/
static void
-mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
GNUNET_assert (key != NULL);
GNUNET_assert (NULL != proc);
- hashSize = sizeof (GNUNET_HashCode);
- hashSize2 = sizeof (GNUNET_HashCode);
+ hashSize = sizeof (struct GNUNET_HashCode);
+ hashSize2 = sizeof (struct GNUNET_HashCode);
memset (cbind, 0, sizeof (cbind));
total = -1;
cbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
const char *query = "SELECT hash FROM gn090";
int ret;
MYSQL_STMT *statement;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
MYSQL_BIND cbind[1];
unsigned long length;
}
while (0 == (ret = mysql_stmt_fetch (statement)))
{
- if (sizeof (GNUNET_HashCode) == length)
+ if (sizeof (struct GNUNET_HashCode) == length)
proc (proc_cls, &key, 1);
}
if (ret != MYSQL_NO_DATA)
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-expi_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+expi_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
* @return GNUNET_OK on success
*/
static int
-postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
uint32_t replication,
struct GNUNET_TIME_Absolute expiration, char **msg)
{
struct Plugin *plugin = cls;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
PGresult *ret;
uint32_t btype = htonl (type);
uint32_t bprio = htonl (priority);
sizeof (bprio),
sizeof (banon),
sizeof (bexpi),
- sizeof (GNUNET_HashCode),
- sizeof (GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
+ sizeof (struct GNUNET_HashCode),
size
};
const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
uint32_t size;
unsigned int rowid;
struct GNUNET_TIME_Absolute expiration_time;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
if (GNUNET_OK !=
GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "select",
(sizeof (uint32_t) != PQfsize (res, 1)) ||
(sizeof (uint32_t) != PQfsize (res, 2)) ||
(sizeof (uint64_t) != PQfsize (res, 3)) ||
- (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 4)))
+ (sizeof (struct GNUNET_HashCode) != PQgetlength (res, 0, 4)))
{
GNUNET_break (0);
PQclear (res);
anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2));
expiration_time.abs_value =
GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3));
- memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode));
+ memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode));
size = PQgetlength (res, 0, 5);
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Found result of size %u bytes and type %u in database\n",
*/
static void
postgres_plugin_get_key (void *cls, uint64_t offset,
- const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+ const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
GNUNET_assert (key != NULL);
paramValues[0] = (const char *) key;
- paramLengths[0] = sizeof (GNUNET_HashCode);
+ paramLengths[0] = sizeof (struct GNUNET_HashCode);
btype = htonl (type);
if (type != 0)
{
if (vhash != NULL)
{
paramValues[1] = (const char *) vhash;
- paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramLengths[1] = sizeof (struct GNUNET_HashCode);
paramValues[2] = (const char *) &btype;
paramLengths[2] = sizeof (btype);
paramValues[3] = (const char *) &blimit_off;
if (vhash != NULL)
{
paramValues[1] = (const char *) vhash;
- paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramLengths[1] = sizeof (struct GNUNET_HashCode);
paramValues[2] = (const char *) &blimit_off;
paramLengths[2] = sizeof (blimit_off);
nparams = 3;
* GNUNET_NO to delete the item and continue (if supported)
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
struct Plugin *plugin = cls;
int ret;
int i;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
PGresult * res;
res = PQexecPrepared (plugin->dbh, "get_keys", 0, NULL, NULL, NULL, 1);
ret = PQntuples (res);
for (i=0;i<ret;i++)
{
- if (sizeof (GNUNET_HashCode) != PQgetlength (res, i, 0))
+ if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0))
{
- memcpy (&key, PQgetvalue (res, i, 0), sizeof (GNUNET_HashCode));
+ memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode));
proc (proc_cls, &key, 1);
}
}
* @return GNUNET_OK on success
*/
static int
-sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity, uint32_t replication,
struct GNUNET_TIME_Absolute expiration, char **msg)
int n;
int ret;
sqlite3_stmt *stmt;
- GNUNET_HashCode vhash;
+ struct GNUNET_HashCode vhash;
uint64_t rvalue;
if (size > MAX_ITEM_SIZE)
(SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) ||
(SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) ||
(SQLITE_OK !=
- sqlite3_bind_blob (stmt, 7, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK !=
- sqlite3_bind_blob (stmt, 8, &vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, 8, &vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
(SQLITE_OK != sqlite3_bind_blob (stmt, 9, data, size, SQLITE_TRANSIENT)))
{
case SQLITE_ROW:
size = sqlite3_column_bytes (stmt, 5);
rowid = sqlite3_column_int64 (stmt, 6);
- if (sqlite3_column_bytes (stmt, 4) != sizeof (GNUNET_HashCode))
+ if (sqlite3_column_bytes (stmt, 4) != sizeof (struct GNUNET_HashCode))
{
GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "sqlite",
_
* @param proc_cls closure for proc
*/
static void
-sqlite_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+sqlite_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
}
sqoff = 1;
ret =
- sqlite3_bind_blob (stmt, sqoff++, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((vhash != NULL) && (ret == SQLITE_OK))
ret =
- sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((type != 0) && (ret == SQLITE_OK))
ret = sqlite3_bind_int (stmt, sqoff++, type);
}
sqoff = 1;
ret =
- sqlite3_bind_blob (stmt, sqoff++, key, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, key, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((vhash != NULL) && (ret == SQLITE_OK))
ret =
- sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (GNUNET_HashCode),
+ sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (struct GNUNET_HashCode),
SQLITE_TRANSIENT);
if ((type != 0) && (ret == SQLITE_OK))
ret = sqlite3_bind_int (stmt, sqoff++, type);
* GNUNET_NO to delete the item
*/
static int
-repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size,
+repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
void *proc_cls)
{
struct Plugin *plugin = cls;
- const GNUNET_HashCode *key;
+ const struct GNUNET_HashCode *key;
sqlite3_stmt *stmt;
int ret;
while (SQLITE_ROW == (ret = sqlite3_step (stmt)))
{
key = sqlite3_column_blob (stmt, 1);
- if (sizeof (GNUNET_HashCode) == sqlite3_column_bytes (stmt, 1))
+ if (sizeof (struct GNUNET_HashCode) == sqlite3_column_bytes (stmt, 1))
proc (proc_cls, key, 1);
}
if (SQLITE_DONE != ret)
* @return GNUNET_OK on success
*/
static int
-template_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size,
+template_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
uint32_t replication,
*/
static void
template_plugin_get_key (void *cls, uint64_t offset,
- const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+ const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
void *proc_cls)
{
struct CpsRunContext
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
int i;
int rid;
const struct GNUNET_CONFIGURATION_Handle *cfg;
static void
-check_value (void *cls, const GNUNET_HashCode * key, size_t size,
+check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
static void
-delete_value (void *cls, const GNUNET_HashCode * key, size_t size,
+delete_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
static void
-check_nothing (void *cls, const GNUNET_HashCode * key, size_t size,
+check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
static void
-check_multiple (void *cls, const GNUNET_HashCode * key, size_t size,
+check_multiple (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
static void
-check_update (void *cls, const GNUNET_HashCode * key, size_t size,
+check_update (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
crc = GNUNET_malloc (sizeof (struct CpsRunContext));
crc->cfg = cfg;
struct CpsRunContext
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
int i;
int found;
const struct GNUNET_CONFIGURATION_Handle *cfg;
static void
-check_value (void *cls, const GNUNET_HashCode * key, size_t size,
+check_value (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
static void
-check_nothing (void *cls, const GNUNET_HashCode * key, size_t size,
+check_nothing (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
uint64_t uid)
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
- static GNUNET_HashCode zkey;
+ static struct GNUNET_HashCode zkey;
crc = GNUNET_malloc (sizeof (struct CpsRunContext));
crc->cfg = cfg;
static void
-gen_key (int i, GNUNET_HashCode * key)
+gen_key (int i, struct GNUNET_HashCode * key)
{
- memset (key, 0, sizeof (GNUNET_HashCode));
+ memset (key, 0, sizeof (struct GNUNET_HashCode));
key->bits[0] = (unsigned int) i;
- GNUNET_CRYPTO_hash (key, sizeof (GNUNET_HashCode), key);
+ GNUNET_CRYPTO_hash (key, sizeof (struct GNUNET_HashCode), key);
}
{
char value[65536];
size_t size;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
char *msg;
unsigned int prio;
static int
-iterate_one_shot (void *cls, const GNUNET_HashCode * key, uint32_t size,
+iterate_one_shot (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
int j;
unsigned long long os;
unsigned long long cs;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/**
* Key of this request
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
/**
* The key to search for
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Unique ID identifying this request, if 0 then
/**
* The key that was searched for
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* put path, get path and actual data are copied to end of this dealy do */
/**
* The key to store the value under.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* DATA copied to end of this message */
/**
* The key to store the value under.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* put path (if tracked) */
/**
* The key to filter messages by.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
};
/**
* The key to store the value under.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* get path (if tracked) */
/**
* The key of the corresponding GET request.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* put path (if tracked) */
/**
* Key that this get request is for
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Unique identifier for this request (for key collisions).
/**
* Key being looked for, NULL == all.
*/
- GNUNET_HashCode *key;
+ struct GNUNET_HashCode *key;
/**
* Callback for each received message of type get.
* @return GNUNET_YES (always)
*/
static int
-add_request_to_pending (void *cls, const GNUNET_HashCode * key, void *value)
+add_request_to_pending (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_DHT_Handle *handle = cls;
struct GNUNET_DHT_GetHandle *rh = value;
* GNUNET_NO if the reply is malformed
*/
static int
-process_reply (void *cls, const GNUNET_HashCode * key, void *value)
+process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct GNUNET_DHT_ClientResultMessage *dht_msg = cls;
struct GNUNET_DHT_GetHandle *get_handle = value;
type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type));
key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key,
- sizeof (GNUNET_HashCode)));
+ sizeof (struct GNUNET_HashCode)));
if (type_ok && key_ok && (NULL != h->get_cb))
h->get_cb (h->cb_cls,
ntohl (msg->options),
type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type));
key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key,
- sizeof (GNUNET_HashCode)));
+ sizeof (struct GNUNET_HashCode)));
if (type_ok && key_ok && (NULL != h->get_resp_cb))
h->get_resp_cb (h->cb_cls,
(enum GNUNET_BLOCK_Type) ntohl(msg->type),
type_ok = (GNUNET_BLOCK_TYPE_ANY == h->type) || (h->type == ntohl(msg->type));
key_ok = (NULL == h->key) || (0 == memcmp (h->key, &msg->key,
- sizeof (GNUNET_HashCode)));
+ sizeof (struct GNUNET_HashCode)));
if (type_ok && key_ok && (NULL != h->put_cb))
h->put_cb (h->cb_cls,
ntohl (msg->options),
* @param cont_cls closure for cont
*/
struct GNUNET_DHT_PutHandle *
-GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key,
+GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode * key,
uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options,
enum GNUNET_BLOCK_Type type, size_t size, const char *data,
*/
struct GNUNET_DHT_GetHandle *
GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
- enum GNUNET_BLOCK_Type type, const GNUNET_HashCode * key,
+ enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode * key,
uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options, const void *xquery,
size_t xquery_size, GNUNET_DHT_GetIterator iter,
struct GNUNET_DHT_MonitorHandle *
GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
GNUNET_DHT_MonitorGetCB get_cb,
GNUNET_DHT_MonitorGetRespCB get_resp_cb,
GNUNET_DHT_MonitorPutCB put_cb,
h->dht_handle = handle;
if (NULL != key)
{
- h->key = GNUNET_malloc (sizeof(GNUNET_HashCode));
- memcpy (h->key, key, sizeof(GNUNET_HashCode));
+ h->key = GNUNET_malloc (sizeof(struct GNUNET_HashCode));
+ memcpy (h->key, key, sizeof(struct GNUNET_HashCode));
}
pending = GNUNET_malloc (sizeof (struct GNUNET_DHT_MonitorStartStopMessage) +
m->put = htons(NULL != put_cb);
if (NULL != key) {
m->filter_key = htons(1);
- memcpy (&m->key, key, sizeof(GNUNET_HashCode));
+ memcpy (&m->key, key, sizeof(struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
pending);
m->put = htons(NULL != handle->put_cb);
if (NULL != handle->key) {
m->filter_key = htons(1);
- memcpy (&m->key, handle->key, sizeof(GNUNET_HashCode));
+ memcpy (&m->key, handle->key, sizeof(struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (handle->dht_handle->pending_head,
handle->dht_handle->pending_tail,
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_TIME_Relative timeout;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
cfg = c;
uint32_t desired_replication_level,
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
- const GNUNET_HashCode * key)
+ const struct GNUNET_HashCode * key)
{
FPRINTF (stdout, "Result %d, operation: %s, type %d\n Key: %s",
result_count,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_TIME_Relative timeout;
- GNUNET_HashCode *key;
+ struct GNUNET_HashCode *key;
cfg = c;
block_type = GNUNET_BLOCK_TYPE_TEST;
if (query_key != NULL) {
- key = GNUNET_malloc (sizeof(GNUNET_HashCode));
+ key = GNUNET_malloc (sizeof(struct GNUNET_HashCode));
GNUNET_CRYPTO_hash (query_key, strlen (query_key), key);
}
else
{
struct GNUNET_TIME_Relative timeout;
struct GNUNET_TIME_Absolute expiration;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
cfg = c;
/**
* The key this request was about
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Client responsible for the request.
/**
* Replies we have already seen for this request.
*/
- GNUNET_HashCode *seen_replies;
+ struct GNUNET_HashCode *seen_replies;
/**
* Pointer to this nodes heap location in the retry-heap (for fast removal)
/**
* Key of data of interest, NULL for all.
*/
- GNUNET_HashCode *key;
+ struct GNUNET_HashCode *key;
/**
* Flag whether to notify about GET messages.
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-remove_client_records (void *cls, const GNUNET_HashCode * key, void *value)
+remove_client_records (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ClientList *client = cls;
struct ClientQueryRecord *record = value;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-remove_by_unique_id (void *cls, const GNUNET_HashCode * key, void *value)
+remove_by_unique_id (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct RemoveByUniqueIdContext *ctx = cls;
struct ClientQueryRecord *record = value;
r->key = NULL;
else
{
- r->key = GNUNET_malloc (sizeof (GNUNET_HashCode));
- memcpy (r->key, &msg->key, sizeof (GNUNET_HashCode));
+ r->key = GNUNET_malloc (sizeof (struct GNUNET_HashCode));
+ memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
else
{
keys_match = (0 != ntohs(msg->filter_key)
- && !memcmp(r->key, &msg->key, sizeof(GNUNET_HashCode)));
+ && !memcmp(r->key, &msg->key, sizeof(struct GNUNET_HashCode)));
}
if (find_active_client(client) == r->client
&& ntohl(msg->type) == r->type
* if the result is mal-formed, GNUNET_NO
*/
static int
-forward_reply (void *cls, const GNUNET_HashCode * key, void *value)
+forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ForwardReplyContext *frc = cls;
struct ClientQueryRecord *record = value;
struct GNUNET_DHT_ClientResultMessage *reply;
enum GNUNET_BLOCK_EvaluationResult eval;
int do_free;
- GNUNET_HashCode ch;
+ struct GNUNET_HashCode ch;
unsigned int i;
if ((record->type != GNUNET_BLOCK_TYPE_ANY) && (record->type != frc->type))
}
GNUNET_CRYPTO_hash (frc->data, frc->data_size, &ch);
for (i = 0; i < record->seen_replies_count; i++)
- if (0 == memcmp (&record->seen_replies[i], &ch, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&record->seen_replies[i], &ch, sizeof (struct GNUNET_HashCode)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Duplicate reply, not passing request for key %s to local client\n",
*/
void
GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *get_path,
unsigned int put_path_length,
uint32_t desired_replication_level,
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
- const GNUNET_HashCode * key)
+ const struct GNUNET_HashCode * key)
{
struct ClientMonitorRecord *m;
struct ClientList **cl;
{
if ((GNUNET_BLOCK_TYPE_ANY == m->type || m->type == type) &&
(NULL == m->key ||
- memcmp (key, m->key, sizeof(GNUNET_HashCode)) == 0))
+ memcmp (key, m->key, sizeof(struct GNUNET_HashCode)) == 0))
{
struct PendingMessage *pm;
struct GNUNET_DHT_MonitorGetMessage *mmsg;
mmsg->hop_count = htonl(hop_count);
mmsg->desired_replication_level = htonl(desired_replication_level);
mmsg->get_path_length = htonl(path_length);
- memcpy (&mmsg->key, key, sizeof (GNUNET_HashCode));
+ memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
memcpy (msg_path, path,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
{
if ((GNUNET_BLOCK_TYPE_ANY == m->type || m->type == type) &&
(NULL == m->key ||
- memcmp (key, m->key, sizeof(GNUNET_HashCode)) == 0))
+ memcmp (key, m->key, sizeof(struct GNUNET_HashCode)) == 0))
{
struct PendingMessage *pm;
struct GNUNET_DHT_MonitorGetRespMessage *mmsg;
memcpy (path, get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (GNUNET_HashCode));
+ memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
memcpy (&path[get_path_length], data, size);
add_pending_message (m->client, pm);
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
{
if ((GNUNET_BLOCK_TYPE_ANY == m->type || m->type == type) &&
(NULL == m->key ||
- memcmp (key, m->key, sizeof(GNUNET_HashCode)) == 0))
+ memcmp (key, m->key, sizeof(struct GNUNET_HashCode)) == 0))
{
struct PendingMessage *pm;
struct GNUNET_DHT_MonitorPutMessage *mmsg;
path_length * sizeof (struct GNUNET_PeerIdentity));
}
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (GNUNET_HashCode));
+ memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
memcpy (&msg_path[path_length], data, size);
add_pending_message (m->client, pm);
*/
void
GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *get_path,
unsigned int put_path_length,
uint32_t desired_replication_level,
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
- const GNUNET_HashCode * key);
+ const struct GNUNET_HashCode * key);
/**
* Check if some client is monitoring GET RESP messages and notify
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size);
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size);
*/
void
GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
enum GNUNET_BLOCK_Type type, size_t data_size,
/**
* The key this request was about
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Number of bytes in xquery.
*/
static int
datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type)
{
struct GetRequestContext *ctx = cls;
* @return evaluation result for the local replies
*/
enum GNUNET_BLOCK_EvaluationResult
-GDS_DATACACHE_handle_get (const GNUNET_HashCode * key,
+GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, const void *xquery,
size_t xquery_size,
struct GNUNET_CONTAINER_BloomFilter **reply_bf,
*/
void
GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
enum GNUNET_BLOCK_Type type, size_t data_size,
* @return evaluation result for the local replies
*/
enum GNUNET_BLOCK_EvaluationResult
-GDS_DATACACHE_handle_get (const GNUNET_HashCode * key,
+GDS_DATACACHE_handle_get (const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type, const void *xquery,
size_t xquery_size,
struct GNUNET_CONTAINER_BloomFilter **reply_bf,
* Free memory occopied by the HELLO.
*/
static int
-free_hello (void *cls, const GNUNET_HashCode * key, void *hello)
+free_hello (void *cls, const struct GNUNET_HashCode * key, void *hello)
{
GNUNET_free (hello);
return GNUNET_OK;
/**
* How many buckets will we allow total.
*/
-#define MAX_BUCKETS sizeof (GNUNET_HashCode) * 8
+#define MAX_BUCKETS sizeof (struct GNUNET_HashCode) * 8
/**
* What is the maximum number of peers in a given bucket.
/**
* The key we are storing under.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* put path (if tracked) */
/**
* The key of the corresponding GET request.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* put path (if tracked) */
/**
* The key we are looking for.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/* xquery */
* on error (same hashcode)
*/
static int
-find_bucket (const GNUNET_HashCode * hc)
+find_bucket (const struct GNUNET_HashCode * hc)
{
unsigned int bits;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-add_known_to_bloom (void *cls, const GNUNET_HashCode * key, void *value)
+add_known_to_bloom (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct BloomConstructorContext *ctx = cls;
- GNUNET_HashCode mh;
+ struct GNUNET_HashCode mh;
GNUNET_BLOCK_mingle_hash (key, ctx->bf_mutator, &mh);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* the two hash codes increases
*/
static unsigned int
-get_distance (const GNUNET_HashCode * target, const GNUNET_HashCode * have)
+get_distance (const struct GNUNET_HashCode * target, const struct GNUNET_HashCode * have)
{
unsigned int bucket;
unsigned int msb;
* mismatching bit at 'bucket' */
lsb = 0;
for (i = bucket + 1;
- (i < sizeof (GNUNET_HashCode) * 8) && (i < bucket + 1 + 32 - 9); i++)
+ (i < sizeof (struct GNUNET_HashCode) * 8) && (i < bucket + 1 + 32 - 9); i++)
{
if (GNUNET_CRYPTO_hash_get_bit (target, i) !=
GNUNET_CRYPTO_hash_get_bit (have, i))
* GNUNET_NO otherwise.
*/
static int
-am_closest_peer (const GNUNET_HashCode * key,
+am_closest_peer (const struct GNUNET_HashCode * key,
const struct GNUNET_CONTAINER_BloomFilter *bloom)
{
int bits;
int count;
struct PeerInfo *pos;
- if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (struct GNUNET_HashCode)))
return GNUNET_YES;
bucket_num = find_bucket (key);
GNUNET_assert (bucket_num >= 0);
* @return Peer to route to, or NULL on error
*/
static struct PeerInfo *
-select_peer (const GNUNET_HashCode * key,
+select_peer (const struct GNUNET_HashCode * key,
const struct GNUNET_CONTAINER_BloomFilter *bloom, uint32_t hops)
{
unsigned int bc;
* @return number of peers returned in 'targets'.
*/
static unsigned int
-get_target_peers (const GNUNET_HashCode * key,
+get_target_peers (const struct GNUNET_HashCode * key,
struct GNUNET_CONTAINER_BloomFilter *bloom,
uint32_t hop_count, uint32_t target_replication,
struct PeerInfo ***targets)
struct GNUNET_TIME_Absolute expiration_time,
uint32_t hop_count,
struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
struct GNUNET_PeerIdentity *put_path,
const void *data, size_t data_size)
GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
enum GNUNET_DHT_RouteOption options,
uint32_t desired_replication_level,
- uint32_t hop_count, const GNUNET_HashCode * key,
+ uint32_t hop_count, const struct GNUNET_HashCode * key,
const void *xquery, size_t xquery_size,
const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
uint32_t reply_bf_mutator,
GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration_time,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int get_path_length,
size_t payload_size;
enum GNUNET_DHT_RouteOption options;
struct GNUNET_CONTAINER_BloomFilter *bf;
- GNUNET_HashCode test_key;
+ struct GNUNET_HashCode test_key;
msize = ntohs (message->size);
if (msize < sizeof (struct PeerPutMessage))
&test_key))
{
case GNUNET_YES:
- if (0 != memcmp (&test_key, &put->key, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&test_key, &put->key, sizeof (struct GNUNET_HashCode)))
{
GNUNET_break_op (0);
return GNUNET_YES;
*/
static void
handle_find_peer (const struct GNUNET_PeerIdentity *sender,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
struct GNUNET_CONTAINER_BloomFilter *bf, uint32_t bf_mutator)
{
int bucket_idx;
struct PeerBucket *bucket;
struct PeerInfo *peer;
unsigned int choice;
- GNUNET_HashCode mhash;
+ struct GNUNET_HashCode mhash;
const struct GNUNET_HELLO_Message *hello;
/* first, check about our own HELLO */
}
/* then, also consider sending a random HELLO from the closest bucket */
- if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&my_identity.hashPubKey, key, sizeof (struct GNUNET_HashCode)))
bucket_idx = closest_bucket;
else
bucket_idx = GNUNET_MIN (closest_bucket, find_bucket (key));
struct GNUNET_TIME_Absolute expiration_time,
uint32_t hop_count,
struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
struct GNUNET_PeerIdentity *put_path,
const void *data, size_t data_size);
GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
enum GNUNET_DHT_RouteOption options,
uint32_t desired_replication_level,
- uint32_t hop_count, const GNUNET_HashCode * key,
+ uint32_t hop_count, const struct GNUNET_HashCode * key,
const void *xquery, size_t xquery_size,
const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
uint32_t reply_bf_mutator,
GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration_time,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int get_path_length,
/**
* Key of this request.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Position of this node in the min heap.
* GNUNET_SYSERR if the result is malformed or type unsupported
*/
static int
-process (void *cls, const GNUNET_HashCode * key, void *value)
+process (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ProcessContext *pc = cls;
struct RecentRequest *rr = value;
enum GNUNET_BLOCK_EvaluationResult eval;
unsigned int gpl;
unsigned int ppl;
- GNUNET_HashCode hc;
- const GNUNET_HashCode *eval_key;
+ struct GNUNET_HashCode hc;
+ const struct GNUNET_HashCode *eval_key;
if ((rr->type != GNUNET_BLOCK_TYPE_ANY) && (rr->type != pc->type))
return GNUNET_OK; /* type missmatch */
void
GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration_time,
- const GNUNET_HashCode * key, unsigned int put_path_length,
+ const struct GNUNET_HashCode * key, unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *get_path,
GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
enum GNUNET_BLOCK_Type type,
enum GNUNET_DHT_RouteOption options,
- const GNUNET_HashCode * key, const void *xquery,
+ const struct GNUNET_HashCode * key, const void *xquery,
size_t xquery_size,
const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
uint32_t reply_bf_mutator)
void
GDS_ROUTING_process (enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute expiration_time,
- const GNUNET_HashCode * key, unsigned int put_path_length,
+ const struct GNUNET_HashCode * key, unsigned int put_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *get_path,
GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
enum GNUNET_BLOCK_Type type,
enum GNUNET_DHT_RouteOption options,
- const GNUNET_HashCode * key, const void *xquery,
+ const struct GNUNET_HashCode * key, const void *xquery,
size_t xquery_size,
const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
uint32_t reply_bf_mutator);
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_dht_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
size_t reply_block_size)
{
- GNUNET_HashCode mhash;
+ struct GNUNET_HashCode mhash;
const struct GNUNET_HELLO_Message *hello;
struct GNUNET_PeerIdentity pid;
const struct GNUNET_MessageHeader *msg;
static int
block_plugin_dht_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
const struct GNUNET_MessageHeader *msg;
const struct GNUNET_HELLO_Message *hello;
static void
test_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
test_get (void *cls, int success)
{
struct PeerContext *peer = cls;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
- memset (&hash, 42, sizeof (GNUNET_HashCode));
+ memset (&hash, 42, sizeof (struct GNUNET_HashCode));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get!\n");
test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerContext *peer = cls;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
char *data;
size_t data_size = 42;
- memset (&hash, 42, sizeof (GNUNET_HashCode));
+ memset (&hash, 42, sizeof (struct GNUNET_HashCode));
data = GNUNET_malloc (data_size);
memset (data, 43, data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_put!\n");
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: ************* FOUND!!! ***********\n");
- if (sizeof (GNUNET_HashCode) == size)
+ if (sizeof (struct GNUNET_HashCode) == size)
{
- const GNUNET_HashCode *h = data;
+ const struct GNUNET_HashCode *h = data;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Contents: %s\n",
GNUNET_h2s_full (h));
uint32_t desired_replication_level,
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
- const GNUNET_HashCode * key)
+ const struct GNUNET_HashCode * key)
{
const char *s_key;
unsigned int i;
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size)
{
get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode search_key; /* Key stored under */
+ struct GNUNET_HashCode search_key; /* Key stored under */
char original_data[TEST_DATA_SIZE]; /* Made up data to store */
test_get->task = GNUNET_SCHEDULER_NO_TASK;
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
size_t size, const void *data)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode search_key; /* Key stored under */
+ struct GNUNET_HashCode search_key; /* Key stored under */
char original_data[TEST_DATA_SIZE]; /* Made up data to store */
memset (original_data, test_get->uid, sizeof (original_data));
}
#endif
- if ((0 != memcmp (&search_key, key, sizeof (GNUNET_HashCode))) ||
+ if ((0 != memcmp (&search_key, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp (original_data, data, sizeof (original_data))))
{
FPRINTF (stderr, "%s", "Key or data is not the same as was inserted!\n");
do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestGetContext *test_get = cls;
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[TEST_DATA_SIZE]; /* Made up data to store */
if (outstanding_gets > MAX_OUTSTANDING_GETS)
do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct TestPutContext *test_put = cls;
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[TEST_DATA_SIZE]; /* Made up data to store */
test_put->task = GNUNET_SCHEDULER_NO_TASK;
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
{
int i;
- if (sizeof (GNUNET_HashCode) == size)
+ if (sizeof (struct GNUNET_HashCode) == size)
{
- const GNUNET_HashCode *h = data;
+ const struct GNUNET_HashCode *h = data;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Contents: %s\n",
GNUNET_h2s_full (h));
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
struct PeerGetContext *get_context = cls;
if (0 !=
- memcmp (&get_context->peer->hashPubKey, key, sizeof (GNUNET_HashCode)))
+ memcmp (&get_context->peer->hashPubKey, key, sizeof (struct GNUNET_HashCode)))
{
FPRINTF (stderr, "%s", "??\n");
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
*/
void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_size,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_size, enum GNUNET_BLOCK_Type type,
size_t size, const void *result_data)
{
- GNUNET_HashCode original_key; /* Key data was stored data under */
+ struct GNUNET_HashCode original_key; /* Key data was stored data under */
char original_data[4]; /* Made up data that was stored */
- memset (&original_key, 42, sizeof (GNUNET_HashCode)); /* Set the key to what it was set to previously */
+ memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to what it was set to previously */
memset (original_data, 43, sizeof (original_data));
#if DNS
if ((sizeof (original_data) != size) ||
- (0 != memcmp (&data.service_descriptor, key, sizeof (GNUNET_HashCode))) ||
+ (0 != memcmp (&data.service_descriptor, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp ((char *) &data, result_data, sizeof (original_data))))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
}
#else
if ((sizeof (original_data) != size) ||
- (0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
+ (0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp (original_data, result_data, sizeof (original_data))))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
static void
do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_HashCode key; /* Key for data lookup */
+ struct GNUNET_HashCode key; /* Key for data lookup */
#if DNS
- memcpy (&key, &data.service_descriptor, sizeof (GNUNET_HashCode));
+ memcpy (&key, &data.service_descriptor, sizeof (struct GNUNET_HashCode));
#else
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
#endif
global_get_handle =
GNUNET_DHT_get_start (peer2dht,
static void
do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[4]; /* Made up data to store */
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
memset (data, 43, sizeof (data));
/* Insert the data at the first peer */
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
size_t size, const void *data)
{
- GNUNET_HashCode original_key; /* Key data was stored data under */
+ struct GNUNET_HashCode original_key; /* Key data was stored data under */
char original_data[4]; /* Made up data that was stored */
- memset (&original_key, 42, sizeof (GNUNET_HashCode)); /* Set the key to what it was set to previously */
+ memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to what it was set to previously */
memset (original_data, 43, sizeof (original_data));
#if VERBOSE
unsigned int i;
#endif
- if ((0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
+ if ((0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp (original_data, data, sizeof (original_data))))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
put_finished (void *cls, int success)
{
- GNUNET_HashCode key; /* Key for data lookup */
+ struct GNUNET_HashCode key; /* Key for data lookup */
GNUNET_SCHEDULER_cancel (die_task);
die_task =
GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
"waiting for get response (data not found)");
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
global_get_handle =
GNUNET_DHT_get_start (peer2dht,
GNUNET_BLOCK_TYPE_TEST, &key, 1,
static void
do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[4]; /* Made up data to store */
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
memset (data, 43, sizeof (data));
/* Insert the data at the first peer */
*/
static void
get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_size,
const struct GNUNET_PeerIdentity *put_path,
unsigned int put_path_size, enum GNUNET_BLOCK_Type type,
size_t size, const void *result_data)
{
- GNUNET_HashCode original_key; /* Key data was stored data under */
+ struct GNUNET_HashCode original_key; /* Key data was stored data under */
char original_data[4]; /* Made up data that was stored */
- memset (&original_key, 42, sizeof (GNUNET_HashCode)); /* Set the key to what it was set to previously */
+ memset (&original_key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to what it was set to previously */
memset (original_data, 43, sizeof (original_data));
if ((sizeof (original_data) != size) ||
- (0 != memcmp (&original_key, key, sizeof (GNUNET_HashCode))) ||
+ (0 != memcmp (&original_key, key, sizeof (struct GNUNET_HashCode))) ||
(0 != memcmp (original_data, result_data, sizeof (original_data))))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
static void
put_finished (void *cls, int success)
{
- GNUNET_HashCode key; /* Key for data lookup */
+ struct GNUNET_HashCode key; /* Key for data lookup */
put_op = NULL;
GNUNET_SCHEDULER_cancel (die_task);
GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &end_badly,
"waiting for get response (data not found)");
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to the same thing as when data was inserted */
global_get_handle =
GNUNET_DHT_get_start (peer2dht,
GNUNET_BLOCK_TYPE_TEST, &key, 1, GNUNET_DHT_RO_NONE,
static void
do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_HashCode key; /* Made up key to store data under */
+ struct GNUNET_HashCode key; /* Made up key to store data under */
char data[4]; /* Made up data to store */
- memset (&key, 42, sizeof (GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
+ memset (&key, 42, sizeof (struct GNUNET_HashCode)); /* Set the key to something simple so we can issue GET request */
memset (data, 43, sizeof (data));
/* Insert the data at the first peer */
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
static int
block_plugin_dns_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
if (type != GNUNET_BLOCK_TYPE_DNS)
return GNUNET_SYSERR;
const struct GNUNET_DNS_Record *rec = block;
- memcpy (key, &rec->service_descriptor, sizeof (GNUNET_HashCode));
+ memcpy (key, &rec->service_descriptor, sizeof (struct GNUNET_HashCode));
return GNUNET_OK;
}
* @param hash set to uid (extended with zeros)
*/
static void
-hash_from_uid (uint32_t uid, GNUNET_HashCode * hash)
+hash_from_uid (uint32_t uid, struct GNUNET_HashCode * hash)
{
- memset (hash, 0, sizeof (GNUNET_HashCode));
+ memset (hash, 0, sizeof (struct GNUNET_HashCode));
*((uint32_t *) hash) = uid;
}
char *sender_address;
char *packed_msg;
char *packed_msg_start;
- GNUNET_HashCode uidhash;
+ struct GNUNET_HashCode uidhash;
struct SendCallbackContext *send_ctx;
if (msg == NULL)
struct GNUNET_DV_SendMessage *msg;
struct SendCallbackContext *send_ctx;
char *end_of_message;
- GNUNET_HashCode uidhash;
+ struct GNUNET_HashCode uidhash;
int msize;
#if DEBUG_DV_MESSAGES
* respective neighbor.
*/
static int
-find_specific_id (void *cls, const GNUNET_HashCode * key, void *value)
+find_specific_id (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindIDContext *fdc = cls;
struct DistantNeighbor *dn = value;
* route.
*/
static int
-find_distant_peer (void *cls, const GNUNET_HashCode * key, void *value)
+find_distant_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindDestinationContext *fdc = cls;
struct DistantNeighbor *distant = value;
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-find_least_cost_peer (void *cls, const GNUNET_HashCode * key, void *value)
+find_least_cost_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindLeastCostContext *find_context = cls;
struct DistantNeighbor *dn = value;
* GNUNET_NO if not.
*/
int
-checkPeerID (void *cls, const GNUNET_HashCode * key, void *value)
+checkPeerID (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct CheckPeerContext *ctx = cls;
struct DistantNeighbor *distant = value;
* GNUNET_NO if not.
*/
int
-print_neighbors (void *cls, const GNUNET_HashCode * key, void *abs_value)
+print_neighbors (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct DistantNeighbor *distant_neighbor = abs_value;
char my_shortname[5];
* GNUNET_NO if not.
*/
int
-send_iterator (void *cls, const GNUNET_HashCode * key, void *abs_value)
+send_iterator (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct DV_SendContext *send_context = cls;
struct DistantNeighbor *distant_neighbor = abs_value;
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-schedule_disconnect_messages (void *cls, const GNUNET_HashCode * key,
+schedule_disconnect_messages (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct DisconnectContext *disconnect_context = cls;
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-free_extended_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+free_extended_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DistantNeighbor *distant = value;
* @return GNUNET_YES to continue iteration, GNUNET_NO to stop
*/
static int
-free_direct_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+free_direct_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DirectNeighbor *direct = value;
* GNUNET_NO if not.
*/
static int
-add_pkey_to_extended (void *cls, const GNUNET_HashCode * key, void *abs_value)
+add_pkey_to_extended (void *cls, const struct GNUNET_HashCode * key, void *abs_value)
{
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pkey = cls;
struct DistantNeighbor *distant_neighbor = abs_value;
* GNUNET_NO if not.
*/
static int
-update_matching_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+update_matching_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NeighborUpdateInfo *update_info = cls;
struct DistantNeighbor *distant_neighbor = value;
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_distant_all_direct_neighbors (void *cls, const GNUNET_HashCode * key,
+add_distant_all_direct_neighbors (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct DirectNeighbor *direct = (struct DirectNeighbor *) value;
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_all_extended_peers (void *cls, const GNUNET_HashCode * key, void *value)
+add_all_extended_peers (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NeighborSendContext *send_context = (struct NeighborSendContext *) cls;
struct DistantNeighbor *distant = (struct DistantNeighbor *) value;
* GNUNET_NO if not.
*/
static int
-gossip_all_to_all_iterator (void *cls, const GNUNET_HashCode * key,
+gossip_all_to_all_iterator (void *cls, const struct GNUNET_HashCode * key,
void *abs_value)
{
struct DirectNeighbor *direct = abs_value;
* @return GNUNET_YES to continue iteration, GNUNET_NO otherwise
*/
static int
-add_all_direct_neighbors (void *cls, const GNUNET_HashCode * key, void *value)
+add_all_direct_neighbors (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DirectNeighbor *direct = (struct DirectNeighbor *) value;
struct DirectNeighbor *to = (struct DirectNeighbor *) cls;
/**
* Identification for the desired service.
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/**
* Skeleton of the TCP header to send. Port numbers are to
/**
* Identification for the desired service.
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/* followed by UDP payload */
};
/**
* Identification for the desired service.
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/**
* ICMP header to use.
/**
* Key this state has in the connections_map.
*/
- GNUNET_HashCode state_key;
+ struct GNUNET_HashCode state_key;
/**
* Associated service record, or NULL for no service.
* @param ri information about the connection
*/
static void
-hash_redirect_info (GNUNET_HashCode *hash,
+hash_redirect_info (struct GNUNET_HashCode *hash,
const struct RedirectInformation *ri)
{
char *off;
- memset (hash, 0, sizeof (GNUNET_HashCode));
+ memset (hash, 0, sizeof (struct GNUNET_HashCode));
/* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash,
so we put the IP address in there (and hope for few collisions) */
off = (char*) hash;
uint16_t destination_port,
const void *local_ip,
uint16_t local_port,
- GNUNET_HashCode *state_key)
+ struct GNUNET_HashCode *state_key)
{
struct RedirectInformation ri;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelState *state;
if ( ( (af == AF_INET) && (protocol == IPPROTO_ICMP) ) ||
*/
static struct LocalService *
find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
- const GNUNET_HashCode *desc,
+ const struct GNUNET_HashCode *desc,
uint16_t destination_port)
{
- char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)];
+ char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
memcpy (&key[0], &destination_port, sizeof (uint16_t));
- memcpy (&key[sizeof(uint16_t)], desc, sizeof (GNUNET_HashCode));
+ memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode));
return GNUNET_CONTAINER_multihashmap_get (service_map,
- (GNUNET_HashCode *) key);
+ (struct GNUNET_HashCode *) key);
}
*/
static int
free_service_record (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct LocalService *service = value;
uint16_t destination_port,
struct LocalService *service)
{
- char key[sizeof (GNUNET_HashCode) + sizeof (uint16_t)];
- GNUNET_HashCode desc;
+ char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
+ struct GNUNET_HashCode desc;
GNUNET_CRYPTO_hash (name, strlen (name) + 1, &desc);
service->name = GNUNET_strdup (name);
memcpy (&key[0], &destination_port, sizeof (uint16_t));
- memcpy (&key[sizeof(uint16_t)], &desc, sizeof (GNUNET_HashCode));
+ memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
if (GNUNET_OK !=
GNUNET_CONTAINER_multihashmap_put (service_map,
- (GNUNET_HashCode *) key,
+ (struct GNUNET_HashCode *) key,
service,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
{
- free_service_record (NULL, (GNUNET_HashCode *) key, service);
+ free_service_record (NULL, (struct GNUNET_HashCode *) key, service);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Got duplicate service records for `%s:%u'\n"),
name,
static void
setup_state_record (struct TunnelState *state)
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelState *s;
/* generate fresh, unique address */
*/
static int
free_iterate (void *cls GNUNET_UNUSED,
- const GNUNET_HashCode * hash GNUNET_UNUSED, void *value)
+ const struct GNUNET_HashCode * hash GNUNET_UNUSED, void *value)
{
GNUNET_free (value);
return GNUNET_YES;
/**
* Hash of the original content, used for encryption.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Hash of the encrypted content, used for querying.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
};
/**
* Hash of the file that we would like to index.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/* this is followed by a 0-terminated
* filename of a file with the hash
/**
* Hash of the indexed file.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/* this is followed by a 0-terminated
* filename of a file with the hash
/**
* Hash of the file that we will unindex.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
};
* <p>
* If the request is for a KBLOCK, "target" must be all zeros.
*/
- GNUNET_HashCode target;
+ struct GNUNET_HashCode target;
/**
* Hash of the keyword (aka query) for KBLOCKs; Hash of
* and hash of the identifier XORed with the target for
* SBLOCKS (aka query).
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/* this is followed by the hash codes of already-known
* results (which should hence be excluded from what
if ((GNUNET_OK != GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
(GNUNET_OK !=
GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id,
- sizeof (GNUNET_HashCode))))
+ sizeof (struct GNUNET_HashCode))))
{
GNUNET_break (0);
goto cleanup;
if ((GNUNET_OK != GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
(GNUNET_OK !=
GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id,
- sizeof (GNUNET_HashCode))))
+ sizeof (struct GNUNET_HashCode))))
{
GNUNET_break (0);
goto cleanup;
if ((GNUNET_OK != GNUNET_BIO_write_int64 (wh, fi->data.file.file_size)) ||
(GNUNET_OK !=
GNUNET_BIO_write (wh, &fi->data.file.file_id,
- sizeof (GNUNET_HashCode))))
+ sizeof (struct GNUNET_HashCode))))
{
GNUNET_break (0);
goto cleanup;
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, (uint32_t) uc->ksk_offset)) ||
((uc->state == UNINDEX_STATE_FS_NOTIFY) &&
(GNUNET_OK !=
- GNUNET_BIO_write (wh, &uc->file_id, sizeof (GNUNET_HashCode)))) ||
+ GNUNET_BIO_write (wh, &uc->file_id, sizeof (struct GNUNET_HashCode)))) ||
((uc->state == UNINDEX_STATE_ERROR) &&
(GNUNET_OK != GNUNET_BIO_write_string (wh, uc->emsg))))
{
sr->update_search !=
NULL ? sr->update_search->serialization : NULL))
|| (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, sr->meta)) ||
- (GNUNET_OK != GNUNET_BIO_write (wh, &sr->key, sizeof (GNUNET_HashCode)))
+ (GNUNET_OK != GNUNET_BIO_write (wh, &sr->key, sizeof (struct GNUNET_HashCode)))
|| (GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->mandatory_missing)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->optional_support)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, sr->availability_success)) ||
case UNINDEX_STATE_FS_NOTIFY:
if (GNUNET_OK !=
GNUNET_BIO_read (rh, "unindex-hash", &uc->file_id,
- sizeof (GNUNET_HashCode)))
+ sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
goto cleanup;
GNUNET_BIO_read_string (rh, "search-lnk", &update_srch, 16)) ||
(GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "result-meta", &sr->meta)) ||
(GNUNET_OK !=
- GNUNET_BIO_read (rh, "result-key", &sr->key, sizeof (GNUNET_HashCode)))
+ GNUNET_BIO_read (rh, "result-key", &sr->key, sizeof (struct GNUNET_HashCode)))
|| (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &sr->mandatory_missing)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &sr->optional_support)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &sr->availability_success)) ||
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-signal_result_resume (void *cls, const GNUNET_HashCode * key, void *value)
+signal_result_resume (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_FS_ProgressInfo pi;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-free_result (void *cls, const GNUNET_HashCode * key, void *value)
+free_result (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_FS_SearchResult *sr = value;
/**
* Hash of the public key for the namespace.
*/
- GNUNET_HashCode namespace;
+ struct GNUNET_HashCode namespace;
/**
* Human-readable identifier chosen for this
* over the entire file (when the indexing process is started).
* Otherwise this field is not used.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/**
* Size of the file (in bytes).
/**
* Key for the search result
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* ID of the task that will clean up the probe_ctx should it not
* @param file_id computed hash, NULL on error
*/
void
-GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id);
+GNUNET_FS_unindex_process_hash_ (void *cls, const struct GNUNET_HashCode * file_id);
/**
/**
* Current key for decrypting KBLocks from 'get_key' operation.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Current query of 'get_key' operation.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/**
* First content UID, 0 for none.
/**
* Hash of the file's contents (once computed).
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/**
* Current operatinonal phase.
* Hash of the original keyword, also known as the
* key (for decrypting the KBlock).
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Hash of the public key, also known as the query.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/**
* Map that contains a "struct GNUNET_FS_SearchResult" for each result that
/**
* Hash of data.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/**
* Data found in P2P network.
* @return GNUNET_YES (we should continue to iterate); unless serious error
*/
static int
-process_result_with_request (void *cls, const GNUNET_HashCode * key,
+process_result_with_request (void *cls, const struct GNUNET_HashCode * key,
void *value);
char enc[len];
struct GNUNET_CRYPTO_AesSessionKey sk;
struct GNUNET_CRYPTO_AesInitializationVector iv;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
GNUNET_CRYPTO_hash_to_aes_key (&chk->key, &sk, &iv);
if (-1 == GNUNET_CRYPTO_aes_encrypt (block, len, &sk, &iv, enc))
return GNUNET_SYSERR;
}
GNUNET_CRYPTO_hash (enc, len, &query);
- if (0 != memcmp (&query, &chk->query, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&query, &chk->query, sizeof (struct GNUNET_HashCode)))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
{
uint64_t off;
char block[DBLOCK_SIZE];
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
uint64_t total;
size_t len;
unsigned int i;
return; /* failure */
}
GNUNET_CRYPTO_hash (block, len, &key);
- if (0 != memcmp (&key, &dr->chk.key, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&key, &dr->chk.key, sizeof (struct GNUNET_HashCode)))
return; /* mismatch */
if (GNUNET_OK !=
encrypt_existing_match (dc, &dr->chk, dr, block, len, GNUNET_NO))
* @return GNUNET_YES (we should continue to iterate); unless serious error
*/
static int
-process_result_with_request (void *cls, const GNUNET_HashCode * key,
+process_result_with_request (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct ProcessResultClosure *prc = cls;
* @return GNUNET_OK
*/
static int
-retry_entry (void *cls, const GNUNET_HashCode * key, void *entry)
+retry_entry (void *cls, const struct GNUNET_HashCode * key, void *entry)
{
struct GNUNET_FS_DownloadContext *dc = cls;
struct DownloadRequest *dr = entry;
struct ProcessNamespaceContext *pnc = cls;
struct GNUNET_CRYPTO_RsaPrivateKey *key;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
const char *name;
const char *t;
const char *msg)
{
struct GNUNET_FS_PublishSksContext *psc = cls;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
psc->dqe = NULL;
if (GNUNET_OK != success)
struct SBlock *sb_enc;
char *dest;
struct GNUNET_CONTAINER_MetaData *mmeta;
- GNUNET_HashCode key; /* hash of thisId = key */
- GNUNET_HashCode id; /* hash of hc = identifier */
- GNUNET_HashCode query; /* id ^ nsid = DB query */
+ struct GNUNET_HashCode key; /* hash of thisId = key */
+ struct GNUNET_HashCode id; /* hash of hc = identifier */
+ struct GNUNET_HashCode query; /* id ^ nsid = DB query */
if (NULL == meta)
mmeta = GNUNET_CONTAINER_meta_data_create ();
size = sizeof (struct SBlock) + mdsize + slen + nidlen;
sb_enc = GNUNET_malloc (size);
GNUNET_CRYPTO_hash (identifier, idlen, &key);
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &id);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &id);
sks_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
sks_uri->type = sks;
GNUNET_CRYPTO_rsa_key_get_public (namespace->key, &sb_enc->subspace);
* GNUNET_NO if not.
*/
static int
-process_update_node (void *cls, const GNUNET_HashCode * key, void *value)
+process_update_node (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ProcessUpdateClosure *pc = cls;
struct NamespaceUpdateNode *nsn = value;
* GNUNET_NO if not.
*/
static int
-find_trees (void *cls, const GNUNET_HashCode * key, void *value)
+find_trees (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindTreeClosure *fc = cls;
struct NamespaceUpdateNode *nsn = value;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
if (nsn->nug == fc->nug)
{
{
unsigned int i;
unsigned int nug;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
struct NamespaceUpdateNode *nsn;
struct ProcessUpdateClosure pc;
struct FindTreeClosure fc;
{
struct GNUNET_FS_AdvertisementContext *ac = cls;
const char *keyword;
- GNUNET_HashCode key;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode key;
+ struct GNUNET_HashCode query;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
struct GNUNET_CRYPTO_RsaPrivateKey *pk;
* @param res resulting hash, NULL on error
*/
static void
-hash_for_index_cb (void *cls, const GNUNET_HashCode * res)
+hash_for_index_cb (void *cls, const struct GNUNET_HashCode * res)
{
struct GNUNET_FS_PublishContext *pc = cls;
struct GNUNET_FS_FileInformation *p;
{
struct GNUNET_FS_PublishKskContext *pkc = cls;
const char *keyword;
- GNUNET_HashCode key;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode key;
+ struct GNUNET_HashCode query;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
struct GNUNET_CRYPTO_RsaPrivateKey *pk;
* GNUNET_OK otherwise
*/
static int
-test_result_present (void *cls, const GNUNET_HashCode * key, void *value)
+test_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct GNUNET_FS_Uri *uri = cls;
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK
*/
static int
-get_result_present (void *cls, const GNUNET_HashCode * key, void *value)
+get_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GetResultContext *grc = cls;
struct GNUNET_FS_SearchResult *sr = value;
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_CONTAINER_MetaData *meta)
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct GNUNET_FS_SearchResult *sr;
struct GetResultContext grc;
int is_new;
const struct GNUNET_CONTAINER_MetaData *meta)
{
struct GNUNET_FS_Uri uu;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct GNUNET_FS_SearchResult *sr;
/* check if new */
size_t edata_size,
char *data)
{
- GNUNET_HashCode q;
+ struct GNUNET_HashCode q;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
int i;
&q);
/* find key */
for (i = 0; i < sc->uri->data.ksk.keywordCount; i++)
- if (0 == memcmp (&q, &sc->requests[i].query, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&q, &sc->requests[i].query, sizeof (struct GNUNET_HashCode)))
break;
if (i == sc->uri->data.ksk.keywordCount)
{
const char *uris;
size_t off;
char *emsg;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
char *identifier;
/* decrypt */
/**
* Where to store the keys.
*/
- GNUNET_HashCode *xoff;
+ struct GNUNET_HashCode *xoff;
/**
* Search context we are iterating for.
* @return GNUNET_OK to continue iterating
*/
static int
-build_result_set (void *cls, const GNUNET_HashCode * key, void *value)
+build_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MessageBuilderContext *mbc = cls;
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK to continue iterating
*/
static int
-find_result_set (void *cls, const GNUNET_HashCode * key, void *value)
+find_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MessageBuilderContext *mbc = cls;
struct GNUNET_FS_SearchResult *sr = value;
size_t msize;
struct SearchMessage *sm;
const char *identifier;
- GNUNET_HashCode key;
- GNUNET_HashCode idh;
+ struct GNUNET_HashCode key;
+ struct GNUNET_HashCode idh;
unsigned int sqms;
uint32_t options;
mbc.skip_cnt = sc->search_request_map_offset;
sm = buf;
sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
- mbc.xoff = (GNUNET_HashCode *) & sm[1];
+ mbc.xoff = (struct GNUNET_HashCode *) & sm[1];
options = SEARCH_MESSAGE_OPTION_NONE;
if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY))
options |= SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY;
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&find_result_set, &mbc);
sqms = mbc.put_cnt;
- mbc.put_cnt = (size - msize) / sizeof (GNUNET_HashCode);
+ mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode);
mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
if (sc->search_request_map_offset < sqms)
GNUNET_assert (mbc.put_cnt > 0);
sm->header.size = htons (msize);
sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
sm->anonymity_level = htonl (sc->anonymity);
- memset (&sm->target, 0, sizeof (GNUNET_HashCode));
+ memset (&sm->target, 0, sizeof (struct GNUNET_HashCode));
sm->query = sc->requests[sc->keyword_offset].query;
- msize += sizeof (GNUNET_HashCode) * mbc.put_cnt;
+ msize += sizeof (struct GNUNET_HashCode) * mbc.put_cnt;
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&build_result_set, &mbc);
sm->header.size = htons (msize);
sm->target = sc->uri->data.sks.namespace;
identifier = sc->uri->data.sks.identifier;
GNUNET_CRYPTO_hash (identifier, strlen (identifier), &key);
- GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &idh);
+ GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &idh);
GNUNET_CRYPTO_hash_xor (&idh, &sm->target, &sm->query);
- mbc.put_cnt = (size - msize) / sizeof (GNUNET_HashCode);
+ mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode);
sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map);
mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
mbc.keyword_offset = 0;
if (sc->search_request_map_offset < sqms)
GNUNET_assert (mbc.put_cnt > 0);
- msize += sizeof (GNUNET_HashCode) * mbc.put_cnt;
+ msize += sizeof (struct GNUNET_HashCode) * mbc.put_cnt;
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&build_result_set, &mbc);
sm->header.size = htons (msize);
sqms =
GNUNET_CONTAINER_multihashmap_size (sc->master_result_map) -
sc->search_request_map_offset;
- fit = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - size) / sizeof (GNUNET_HashCode);
+ fit = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - size) / sizeof (struct GNUNET_HashCode);
fit = GNUNET_MIN (fit, sqms);
- size += sizeof (GNUNET_HashCode) * fit;
+ size += sizeof (struct GNUNET_HashCode) * fit;
GNUNET_CLIENT_notify_transmit_ready (sc->client, size,
GNUNET_CONSTANTS_SERVICE_TIMEOUT,
GNUNET_NO, &transmit_search_request, sc);
{
unsigned int i;
const char *keyword;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
struct GNUNET_CRYPTO_RsaPrivateKey *pk;
* @return GNUNET_OK
*/
static int
-search_result_freeze_probes (void *cls, const GNUNET_HashCode * key,
+search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK
*/
static int
-search_result_resume_probes (void *cls, const GNUNET_HashCode * key,
+search_result_resume_probes (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK
*/
static int
-search_result_suspend (void *cls, const GNUNET_HashCode * key, void *value)
+search_result_suspend (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK
*/
static int
-search_result_stop (void *cls, const GNUNET_HashCode * key, void *value)
+search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_FS_SearchResult *sr = value;
* @return GNUNET_OK
*/
static int
-search_result_free (void *cls, const GNUNET_HashCode * key, void *value)
+search_result_free (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_FS_SearchResult *sr = value;
{
struct GNUNET_CONTAINER_MultiHashMap *mcm = cls;
struct KeywordCounter *cnt;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
size_t klen;
klen = strlen (keyword) + 1;
const char *data_mime_type, const char *data, size_t data_len)
{
struct GNUNET_CONTAINER_MultiHashMap *map = cls;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct MetaCounter *cnt;
GNUNET_CRYPTO_hash (data, data_len, &key);
{
struct TrimContext *tc = cls;
struct KeywordCounter *counter;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
size_t klen;
klen = strlen (keyword) + 1;
* @return GNUNET_YES (always)
*/
static int
-migrate_and_drop_keywords (void *cls, const GNUNET_HashCode * key, void *value)
+migrate_and_drop_keywords (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct TrimContext *tc = cls;
struct KeywordCounter *counter = value;
* @return GNUNET_YES (always)
*/
static int
-migrate_and_drop_metadata (void *cls, const GNUNET_HashCode * key, void *value)
+migrate_and_drop_metadata (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct TrimContext *tc = cls;
struct MetaCounter *counter = value;
*/
static void
process_kblock_for_unindex (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
size_t size, const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
* @param file_id computed hash, NULL on error
*/
void
-GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id)
+GNUNET_FS_unindex_process_hash_ (void *cls, const struct GNUNET_HashCode * file_id)
{
struct GNUNET_FS_UnindexContext *uc = cls;
* @param key wherer to store the unique key
*/
void
-GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * key)
+GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode * key)
{
switch (uri->type)
{
key);
break;
default:
- memset (key, 0, sizeof (GNUNET_HashCode));
+ memset (key, 0, sizeof (struct GNUNET_HashCode));
break;
}
}
uri_sks_parse (const char *s, char **emsg)
{
struct GNUNET_FS_Uri *ret;
- GNUNET_HashCode namespace;
+ struct GNUNET_HashCode namespace;
char *identifier;
unsigned int pos;
size_t slen;
* @return an FS URI for the given namespace and identifier
*/
struct GNUNET_FS_Uri *
-GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id)
+GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_HashCode * nsid, const char *id)
{
struct GNUNET_FS_Uri *ns_uri;
case sks:
if ((0 ==
memcmp (&u1->data.sks.namespace, &u2->data.sks.namespace,
- sizeof (GNUNET_HashCode))) &&
+ sizeof (struct GNUNET_HashCode))) &&
(0 == strcmp (u1->data.sks.identifier, u2->data.sks.identifier)))
return GNUNET_YES;
*/
int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
- GNUNET_HashCode * nsid)
+ struct GNUNET_HashCode * nsid)
{
if (!GNUNET_FS_uri_test_sks (uri))
{
static char *
uri_sks_to_string (const struct GNUNET_FS_Uri *uri)
{
- const GNUNET_HashCode *namespace;
+ const struct GNUNET_HashCode *namespace;
const char *identifier;
char *ret;
struct GNUNET_CRYPTO_HashAsciiEncoded ns;
* @return GNUNET_OK to continue iteration
*/
static int
-print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id)
+print_indexed (void *cls, const char *filename, const struct GNUNET_HashCode * file_id)
{
if (NULL == filename)
{
static void
-ns_printer (void *cls, const char *name, const GNUNET_HashCode * id)
+ns_printer (void *cls, const char *name, const struct GNUNET_HashCode * id)
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
static int
-pseudo_printer (void *cls, const GNUNET_HashCode * pseudonym,
+pseudo_printer (void *cls, const struct GNUNET_HashCode * pseudonym,
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
static void
post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
{
- GNUNET_HashCode nsid;
+ struct GNUNET_HashCode nsid;
char *set;
int delta;
* @return GNUNET_YES to continue to iterate
*/
static int
-consider_peer_for_forwarding (void *cls, const GNUNET_HashCode * key,
+consider_peer_for_forwarding (void *cls, const struct GNUNET_HashCode * key,
struct GSF_PendingRequest *pr)
{
struct GSF_ConnectedPeer *cp = cls;
/**
* Which of the optional hash codes are present at the end of the
* message? See GET_MESSAGE_BIT_xx constants. For each bit that is
- * set, an additional GNUNET_HashCode with the respective content
+ * set, an additional struct GNUNET_HashCode with the respective content
* (in order of the bits) will be appended to the end of the GET
* message.
*/
* Hashcodes of the file(s) we're looking for.
* Details depend on the query type.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/* this is followed by hash codes as specified in the "hash_bitmap";
* after that, an optional bloomfilter (with bits set for replies
*/
static void
free_pending_request (struct PeerRequest *peerreq,
- const GNUNET_HashCode *query)
+ const struct GNUNET_HashCode *query)
{
struct GSF_ConnectedPeer *cp = peerreq->cp;
* @return GNUNET_YES (continue to iterate)
*/
static int
-cancel_pending_request (void *cls, const GNUNET_HashCode * query, void *value)
+cancel_pending_request (void *cls, const struct GNUNET_HashCode * query, void *value)
{
struct PeerRequest *peerreq = value;
struct GSF_PendingRequest *pr = peerreq->pr;
struct GSF_PendingRequestData *prd;
struct GSF_ConnectedPeer *cp;
struct GSF_ConnectedPeer *cps;
- const GNUNET_HashCode *namespace;
+ const struct GNUNET_HashCode *namespace;
const struct GNUNET_PeerIdentity *target;
enum GSF_PendingRequestOptions options;
uint16_t msize;
const struct GetMessage *gm;
unsigned int bits;
- const GNUNET_HashCode *opt;
+ const struct GNUNET_HashCode *opt;
uint32_t bm;
size_t bfsize;
uint32_t ttl_decrement;
bits++;
bm >>= 1;
}
- if (msize < sizeof (struct GetMessage) + bits * sizeof (GNUNET_HashCode))
+ if (msize < sizeof (struct GetMessage) + bits * sizeof (struct GNUNET_HashCode))
{
GNUNET_break_op (0);
return NULL;
}
- opt = (const GNUNET_HashCode *) &gm[1];
- bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (GNUNET_HashCode);
+ opt = (const struct GNUNET_HashCode *) &gm[1];
+ bfsize = msize - sizeof (struct GetMessage) - bits * sizeof (struct GNUNET_HashCode);
/* bfsize must be power of 2, check! */
if (0 != ((bfsize - 1) & bfsize))
{
prd = GSF_pending_request_get_data_ (pr);
if ((prd->type == type) &&
((type != GNUNET_BLOCK_TYPE_FS_SBLOCK) ||
- (0 == memcmp (&prd->namespace, namespace, sizeof (GNUNET_HashCode)))))
+ (0 == memcmp (&prd->namespace, namespace, sizeof (struct GNUNET_HashCode)))))
{
if (prd->ttl.abs_value >= GNUNET_TIME_absolute_get ().abs_value + ttl)
{
* @return GNUNET_YES to continue iteration
*/
static int
-call_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+call_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct IterationContext *ic = cls;
struct GSF_ConnectedPeer *cp = value;
* @return GNUNET_OK to continue iteration
*/
static int
-flush_trust (void *cls, const GNUNET_HashCode * key, void *value)
+flush_trust (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GSF_ConnectedPeer *cp = value;
char *fn;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-clean_peer (void *cls, const GNUNET_HashCode * key, void *value)
+clean_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
GSF_peer_disconnect_handler_ (NULL, (const struct GNUNET_PeerIdentity *) key);
return GNUNET_YES;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-clean_local_client (void *cls, const GNUNET_HashCode * key, void *value)
+clean_local_client (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const struct GSF_LocalClient *lc = cls;
struct GSF_ConnectedPeer *cp = value;
/**
* Hash of the contents of the file.
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
};
while (pos != NULL)
{
if ((GNUNET_OK !=
- GNUNET_BIO_write (wh, &pos->file_id, sizeof (GNUNET_HashCode))) ||
+ GNUNET_BIO_write (wh, &pos->file_id, sizeof (struct GNUNET_HashCode))) ||
(GNUNET_OK != GNUNET_BIO_write_string (wh, pos->filename)))
break;
pos = pos->next;
char *fn;
struct IndexInfo *pos;
char *fname;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
size_t slen;
char *emsg;
}
while ((GNUNET_OK ==
GNUNET_BIO_read (rh, "Hash of indexed file", &hc,
- sizeof (GNUNET_HashCode))) &&
+ sizeof (struct GNUNET_HashCode))) &&
(GNUNET_OK ==
GNUNET_BIO_read_string (rh, "Name of indexed file", &fname,
1024 * 16)) && (fname != NULL))
* @param res resulting hash, NULL on error
*/
static void
-hash_for_index_val (void *cls, const GNUNET_HashCode * res)
+hash_for_index_val (void *cls, const struct GNUNET_HashCode * res)
{
struct IndexInfo *ii = cls;
ii->fhc = NULL;
if ((res == NULL) ||
- (0 != memcmp (res, &ii->file_id, sizeof (GNUNET_HashCode))))
+ (0 != memcmp (res, &ii->file_id, sizeof (struct GNUNET_HashCode))))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_
while (NULL != pos)
{
next = pos->next;
- if (0 == memcmp (&pos->file_id, &um->file_id, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&pos->file_id, &um->file_id, sizeof (struct GNUNET_HashCode)))
{
if (prev == NULL)
indexed_files = next;
* @return GNUNET_OK on success
*/
int
-GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, uint32_t size,
+GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration,
void *cont_cls)
{
const struct OnDemandBlock *odb;
- GNUNET_HashCode nkey;
+ struct GNUNET_HashCode nkey;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
ssize_t nsize;
char ndata[DBLOCK_SIZE];
char edata[DBLOCK_SIZE];
GNUNET_CRYPTO_hash_to_aes_key (&nkey, &skey, &iv);
GNUNET_CRYPTO_aes_encrypt (ndata, nsize, &skey, &iv, edata);
GNUNET_CRYPTO_hash (edata, nsize, &query);
- if (0 != memcmp (&query, key, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&query, key, sizeof (struct GNUNET_HashCode)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Indexed file `%s' changed at offset %llu\n"), fn,
* @return GNUNET_OK on success
*/
int
-GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, uint32_t size,
+GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration,
*message,
struct GSF_PendingRequest **prptr)
{
- static GNUNET_HashCode all_zeros;
+ static struct GNUNET_HashCode all_zeros;
const struct SearchMessage *sm;
struct GSF_LocalClient *lc;
struct ClientRequest *cr;
msize = ntohs (message->size);
if ((msize < sizeof (struct SearchMessage)) ||
- (0 != (msize - sizeof (struct SearchMessage)) % sizeof (GNUNET_HashCode)))
+ (0 != (msize - sizeof (struct SearchMessage)) % sizeof (struct GNUNET_HashCode)))
{
GNUNET_break (0);
*prptr = NULL;
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop ("# client searches received"), 1,
GNUNET_NO);
- sc = (msize - sizeof (struct SearchMessage)) / sizeof (GNUNET_HashCode);
+ sc = (msize - sizeof (struct SearchMessage)) / sizeof (struct GNUNET_HashCode);
sm = (const struct SearchMessage *) message;
type = ntohl (sm->type);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
(SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a
matching query and type */
if ((GNUNET_YES != prd->has_started) &&
- (0 != memcmp (&prd->query, &sm->query, sizeof (GNUNET_HashCode))) &&
+ (0 != memcmp (&prd->query, &sm->query, sizeof (struct GNUNET_HashCode))) &&
(prd->type == type))
break;
cr = cr->next;
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Have existing request, merging content-seen lists.\n");
- GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc);
+ GSF_pending_request_update_ (cr->pr, (const struct GNUNET_HashCode *) &sm[1], sc);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
("# client searches updated (merged content seen list)"),
: NULL,
(0 !=
memcmp (&sm->target, &all_zeros,
- sizeof (GNUNET_HashCode)))
+ sizeof (struct GNUNET_HashCode)))
? (const struct GNUNET_PeerIdentity *)
&sm->target : NULL, NULL, 0,
0 /* bf */ ,
0 /* ttl */ ,
0 /* sender PID */ ,
0 /* origin PID */ ,
- (const GNUNET_HashCode *) &sm[1], sc,
+ (const struct GNUNET_HashCode *) &sm[1], sc,
&client_response_handler, cr);
}
*prptr = cr->pr;
* @param rp a request plan
* @return the associated query
*/
-static const GNUNET_HashCode *
+static const struct GNUNET_HashCode *
get_rp_key (struct GSF_RequestPlan *rp)
{
return &GSF_pending_request_get_data_ (rp->prl_head->pr)->query;
* GNUNET_NO if not (merge success)
*/
static int
-merge_pr (void *cls, const GNUNET_HashCode * query, void *element)
+merge_pr (void *cls, const struct GNUNET_HashCode * query, void *element)
{
struct MergeContext *mpr = cls;
struct GSF_RequestPlan *rp = element;
/**
* Array of hash codes of replies we've already seen.
*/
- GNUNET_HashCode *replies_seen;
+ struct GNUNET_HashCode *replies_seen;
/**
* Bloomfilter masking replies we've already seen.
struct GSF_PendingRequest *
GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
- const GNUNET_HashCode * namespace,
+ const struct GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * namespace,
const struct GNUNET_PeerIdentity *target,
const char *bf_data, size_t bf_size,
uint32_t mingle, uint32_t anonymity_level,
uint32_t priority, int32_t ttl,
GNUNET_PEER_Id sender_pid,
GNUNET_PEER_Id origin_pid,
- const GNUNET_HashCode * replies_seen,
+ const struct GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count,
GSF_PendingRequestReplyHandler rh, void *rh_cls)
{
{
pr->replies_seen_size = replies_seen_count;
pr->replies_seen =
- GNUNET_malloc (sizeof (GNUNET_HashCode) * pr->replies_seen_size);
+ GNUNET_malloc (sizeof (struct GNUNET_HashCode) * pr->replies_seen_size);
memcpy (pr->replies_seen, replies_seen,
- replies_seen_count * sizeof (GNUNET_HashCode));
+ replies_seen_count * sizeof (struct GNUNET_HashCode));
pr->replies_seen_count = replies_seen_count;
}
if (NULL != bf_data)
if ((pra->public_data.type != prb->public_data.type) ||
(0 !=
memcmp (&pra->public_data.query, &prb->public_data.query,
- sizeof (GNUNET_HashCode))) ||
+ sizeof (struct GNUNET_HashCode))) ||
((pra->public_data.type == GNUNET_BLOCK_TYPE_FS_SBLOCK) &&
(0 !=
memcmp (&pra->public_data.namespace, &prb->public_data.namespace,
- sizeof (GNUNET_HashCode)))))
+ sizeof (struct GNUNET_HashCode)))))
return GNUNET_NO;
return GNUNET_OK;
}
*/
void
GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
- const GNUNET_HashCode * replies_seen,
+ const struct GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count)
{
unsigned int i;
- GNUNET_HashCode mhash;
+ struct GNUNET_HashCode mhash;
if (replies_seen_count + pr->replies_seen_count < pr->replies_seen_count)
return; /* integer overflow */
GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size,
replies_seen_count + pr->replies_seen_count);
memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen,
- sizeof (GNUNET_HashCode) * replies_seen_count);
+ sizeof (struct GNUNET_HashCode) * replies_seen_count);
pr->replies_seen_count += replies_seen_count;
refresh_bloomfilter (pr);
}
{
char lbuf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
struct GetMessage *gm;
- GNUNET_HashCode *ext;
+ struct GNUNET_HashCode *ext;
size_t msize;
unsigned int k;
uint32_t bm;
k++;
}
bf_size = GNUNET_CONTAINER_bloomfilter_get_size (pr->bf);
- msize = sizeof (struct GetMessage) + bf_size + k * sizeof (GNUNET_HashCode);
+ msize = sizeof (struct GetMessage) + bf_size + k * sizeof (struct GNUNET_HashCode);
GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
if (buf_size < msize)
return msize;
gm->filter_mutator = htonl (pr->mingle);
gm->hash_bitmap = htonl (bm);
gm->query = pr->public_data.query;
- ext = (GNUNET_HashCode *) & gm[1];
+ ext = (struct GNUNET_HashCode *) & gm[1];
k = 0;
if (!do_route)
GNUNET_PEER_resolve (pr->sender_pid,
(struct GNUNET_PeerIdentity *) &ext[k++]);
if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type)
- memcpy (&ext[k++], &pr->public_data.namespace, sizeof (GNUNET_HashCode));
+ memcpy (&ext[k++], &pr->public_data.namespace, sizeof (struct GNUNET_HashCode));
if (GNUNET_YES == pr->public_data.has_target)
ext[k++] = pr->public_data.target.hashPubKey;
if (pr->bf != NULL)
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-clean_request (void *cls, const GNUNET_HashCode * key, void *value)
+clean_request (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GSF_PendingRequest *pr = value;
GSF_LocalLookupContinuation cont;
* @return GNUNET_YES (we should continue to iterate)
*/
static int
-process_reply (void *cls, const GNUNET_HashCode * key, void *value)
+process_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ProcessReplyClosure *prq = cls;
struct GSF_PendingRequest *pr = value;
- GNUNET_HashCode chash;
+ struct GNUNET_HashCode chash;
struct GNUNET_TIME_Absolute last_transmission;
if (NULL == pr->rh)
&pr->public_data.namespace,
(prq->type ==
GNUNET_BLOCK_TYPE_FS_SBLOCK) ?
- sizeof (GNUNET_HashCode) : 0, prq->data,
+ sizeof (struct GNUNET_HashCode) : 0, prq->data,
prq->size);
switch (prq->eval)
{
*/
static void
handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
const void *xquery;
size_t xquery_size;
struct GNUNET_PeerIdentity pi;
- char buf[sizeof (GNUNET_HashCode) * 2] GNUNET_ALIGN;
+ char buf[sizeof (struct GNUNET_HashCode) * 2] GNUNET_ALIGN;
if (0 != pr->public_data.anonymity_level)
return;
if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type)
{
xquery = buf;
- memcpy (buf, &pr->public_data.namespace, sizeof (GNUNET_HashCode));
- xquery_size = sizeof (GNUNET_HashCode);
+ memcpy (buf, &pr->public_data.namespace, sizeof (struct GNUNET_HashCode));
+ xquery_size = sizeof (struct GNUNET_HashCode);
}
if (0 != (pr->public_data.options & GSF_PRO_FORWARD_ONLY))
{
* maybe 0 if no unique identifier is available
*/
static void
-process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size,
+process_local_reply (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
struct GSF_PendingRequest *pr = cls;
GSF_LocalLookupContinuation cont;
struct ProcessReplyClosure prq;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
unsigned int old_rf;
GNUNET_SCHEDULER_cancel (pr->warn_task);
size_t dsize;
enum GNUNET_BLOCK_Type type;
struct GNUNET_TIME_Absolute expiration;
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
struct ProcessReplyClosure prq;
struct GNUNET_TIME_Relative block_time;
double putl;
/**
* Primary query hash for this request.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/**
* Namespace to query, only set if the type is SBLOCK.
*/
- GNUNET_HashCode namespace;
+ struct GNUNET_HashCode namespace;
/**
* Identity of a peer hosting the content, only set if
struct GSF_PendingRequest *
GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
- const GNUNET_HashCode * namespace,
+ const struct GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * namespace,
const struct GNUNET_PeerIdentity *target,
const char *bf_data, size_t bf_size,
uint32_t mingle, uint32_t anonymity_level,
uint32_t priority, int32_t ttl,
GNUNET_PEER_Id sender_pid,
GNUNET_PEER_Id origin_pid,
- const GNUNET_HashCode * replies_seen,
+ const struct GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count,
GSF_PendingRequestReplyHandler rh, void *rh_cls);
*/
void
GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
- const GNUNET_HashCode * replies_seen,
+ const struct GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count);
* @return GNUNET_YES to continue to iterate
*/
typedef int (*GSF_PendingRequestIterator) (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
struct GSF_PendingRequest * pr);
/**
* Query for the block.
*/
- GNUNET_HashCode query;
+ struct GNUNET_HashCode query;
/**
* When does this block expire?
* maybe 0 if no unique identifier is available
*/
static void
-process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size,
+process_migration_content (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
* maybe 0 if no unique identifier is available
*/
static void
-process_dht_put_content (void *cls, const GNUNET_HashCode * key, size_t size,
+process_dht_put_content (void *cls, const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
struct GNUNET_TIME_Absolute expiration, uint64_t uid)
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
size_t reply_block_size)
{
const struct SBlock *sb;
- GNUNET_HashCode chash;
- GNUNET_HashCode mhash;
- const GNUNET_HashCode *nsid;
- GNUNET_HashCode sh;
+ struct GNUNET_HashCode chash;
+ struct GNUNET_HashCode mhash;
+ const struct GNUNET_HashCode *nsid;
+ struct GNUNET_HashCode sh;
switch (type)
{
}
return GNUNET_BLOCK_EVALUATION_OK_MORE;
case GNUNET_BLOCK_TYPE_FS_SBLOCK:
- if (xquery_size != sizeof (GNUNET_HashCode))
+ if (xquery_size != sizeof (struct GNUNET_HashCode))
{
GNUNET_break_op (0);
return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
GNUNET_CRYPTO_hash (&sb->subspace,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sh);
- if (0 != memcmp (nsid, &sh, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (nsid, &sh, sizeof (struct GNUNET_HashCode)))
{
GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "block-fs",
_
static int
block_plugin_fs_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
const struct KBlock *kb;
const struct SBlock *sb;
static struct PeerContext p1;
-static GNUNET_HashCode nsid;
+static struct GNUNET_HashCode nsid;
static struct GNUNET_FS_Uri *sks_expect_uri;
static void
-ns_iterator (void *cls, const char *name, const GNUNET_HashCode * id)
+ns_iterator (void *cls, const char *name, const struct GNUNET_HashCode * id)
{
int *ok = cls;
struct GNSNameRecordBlock *nrb;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode zhash;
- GNUNET_HashCode xor_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode xor_hash;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
uint32_t rd_payload_length;
char* nrb_data = NULL;
size_t namelen;
static void
process_auth_discovery_dht_result(void* cls,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
{
uint32_t xquery;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
- GNUNET_HashCode lookup_key;
+ struct GNUNET_HashCode lookup_key;
struct GNUNET_CRYPTO_HashAsciiEncoded lookup_key_string;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
int i;
struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls;
static void
process_record_result_dht(void* cls,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
{
uint32_t xquery;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
- GNUNET_HashCode lookup_key;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode lookup_key;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
struct GNUNET_CRYPTO_HashAsciiEncoded lookup_key_string;
struct RecordLookupHandle *rlh = (struct RecordLookupHandle *)rh->proc_cls;
struct ResolverHandle *rh_heap_root;
static void
process_delegation_result_dht(void* cls,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
int i;
int rd_size;
struct GNUNET_CRYPTO_ShortHashCode zone, name_hash;
- GNUNET_HashCode zone_hash_double, name_hash_double;
+ struct GNUNET_HashCode zone_hash_double, name_hash_double;
rh = (struct ResolverHandle *)cls;
{
uint32_t xquery;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
- GNUNET_HashCode lookup_key;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode lookup_key;
struct ResolverHandle *rh_heap_root;
pop_tld(rh->name, rh->authority_name);
*/
static enum GNUNET_BLOCK_EvaluationResult
block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
size_t reply_block_size)
{
char* name;
- GNUNET_HashCode pkey_hash_double;
- GNUNET_HashCode query_key;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode mhash;
- GNUNET_HashCode chash;
+ struct GNUNET_HashCode pkey_hash_double;
+ struct GNUNET_HashCode query_key;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode mhash;
+ struct GNUNET_HashCode chash;
struct GNUNET_CRYPTO_ShortHashCode pkey_hash;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNSNameRecordBlock *nrb;
static int
block_plugin_gns_get_key (void *cls, enum GNUNET_BLOCK_Type type,
const void *block, size_t block_size,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD)
return GNUNET_SYSERR;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode pkey_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode pkey_hash_double;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode pkey_hash_double;
struct GNSNameRecordBlock *nrb = (struct GNSNameRecordBlock *)block;
struct GNSNameRecordBlock *nrb;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- GNUNET_HashCode xor_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode xor_hash;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
uint32_t rd_payload_length;
char* nrb_data = NULL;
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNSNameRecordBlock *nrb;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- GNUNET_HashCode xor_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode xor_hash;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
uint32_t rd_payload_length;
char* nrb_data = NULL;
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNSNameRecordBlock *nrb;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- GNUNET_HashCode xor_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode xor_hash;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
uint32_t rd_payload_length;
char* nrb_data = NULL;
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNSNameRecordBlock *nrb;
struct GNUNET_CRYPTO_ShortHashCode name_hash;
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- GNUNET_HashCode xor_hash;
- GNUNET_HashCode name_hash_double;
- GNUNET_HashCode zone_hash_double;
+ struct GNUNET_HashCode xor_hash;
+ struct GNUNET_HashCode name_hash_double;
+ struct GNUNET_HashCode zone_hash_double;
uint32_t rd_payload_length;
char* nrb_data = NULL;
struct GNUNET_CRYPTO_RsaSignature *sig;
* The descriptor for the service
* (a peer may provide more than one service)
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/**
* When does this record expire?
* used as the key for decryption; the xor of this identifier
* and the hash of the "keyspace" is the datastore-query hash).
*/
- GNUNET_HashCode identifier;
+ struct GNUNET_HashCode identifier;
/**
* Public key of the namespace.
* file that was indexed (used to uniquely
* identify the plaintext file).
*/
- GNUNET_HashCode file_id;
+ struct GNUNET_HashCode file_id;
/**
* At which offset should we be able to find
* @param hc where to store the result.
*/
void
-GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, uint32_t mingle_number,
- GNUNET_HashCode * hc);
+GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number,
+ struct GNUNET_HashCode * hc);
/**
enum GNUNET_BLOCK_EvaluationResult
GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode * query,
+ const struct GNUNET_HashCode * query,
struct GNUNET_CONTAINER_BloomFilter **bf,
int32_t bf_mutator, const void *xquery,
size_t xquery_size, const void *reply_block,
int
GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type, const void *block,
- size_t block_size, GNUNET_HashCode * key);
+ size_t block_size, struct GNUNET_HashCode * key);
*/
struct GNUNET_CONTAINER_BloomFilter *
GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator,
- const GNUNET_HashCode * seen_results,
+ const struct GNUNET_HashCode * seen_results,
unsigned int seen_results_count);
GNUNET_BLOCK_Type
type,
const
- GNUNET_HashCode
+ struct GNUNET_HashCode
* query,
struct
GNUNET_CONTAINER_BloomFilter
enum GNUNET_BLOCK_Type type,
const void *block,
size_t block_size,
- GNUNET_HashCode * key);
+ struct GNUNET_HashCode * key);
*/
typedef int (*GNUNET_CHAT_MessageCallback) (void *cls,
struct GNUNET_CHAT_Room * room,
- const GNUNET_HashCode * sender,
+ const struct GNUNET_HashCode * sender,
const struct
GNUNET_CONTAINER_MetaData *
member_info, const char *message,
uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute
timestamp,
- const GNUNET_HashCode *
+ const struct GNUNET_HashCode *
receiver);
/**
GNUNET_CHAT_MemberListCallback memberCallback,
void *member_cls,
GNUNET_CHAT_MessageConfirmation confirmationCallback,
- void *confirmation_cls, GNUNET_HashCode * me);
+ void *confirmation_cls, struct GNUNET_HashCode * me);
/**
* Send a message.
/**
* @brief 512-bit hashcode
*/
-typedef struct GNUNET_HashCode
+struct GNUNET_HashCode
{
uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
-}
-GNUNET_HashCode;
+};
/**
*/
struct GNUNET_PeerIdentity
{
- GNUNET_HashCode hashPubKey;
+ struct GNUNET_HashCode hashPubKey;
};
GNUNET_NETWORK_STRUCT_END
* @return string
*/
const char *
-GNUNET_h2s (const GNUNET_HashCode * hc);
+GNUNET_h2s (const struct GNUNET_HashCode * hc);
/**
* @return string
*/
const char *
-GNUNET_h2s_full (const GNUNET_HashCode * hc);
+GNUNET_h2s_full (const struct GNUNET_HashCode * hc);
/**
* Size of the 'struct EncryptedMessage' of the core (which
* is the per-message overhead of the core).
*/
-#define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof (GNUNET_HashCode))
+#define GNUNET_CONSTANTS_CORE_SIZE_ENCRYPTED_MESSAGE (24 + sizeof (struct GNUNET_HashCode))
/**
* Size of the 'struct OutboundMessage' of the transport
* @return GNUNET_YES if next was updated
* GNUNET_NO if there are no more entries
*/
-typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next);
+typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next);
/**
*/
int
GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
- *bf, const GNUNET_HashCode * e);
+ *bf, const struct GNUNET_HashCode * e);
/**
*/
void
GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e);
+ const struct GNUNET_HashCode * e);
/**
*/
void
GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e);
+ const struct GNUNET_HashCode * e);
/**
* GNUNET_NO if not.
*/
typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value);
*/
void *
GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key);
+ *map, const struct GNUNET_HashCode * key);
/**
*/
int
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value);
+ const struct GNUNET_HashCode * key, void *value);
/**
* Remove all entries for the given key from the map.
*/
int
GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key);
+ *map, const struct GNUNET_HashCode * key);
/**
int
GNUNET_CONTAINER_multihashmap_contains (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key);
+ const struct GNUNET_HashCode * key);
/**
int
GNUNET_CONTAINER_multihashmap_contains_value (const struct
GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key,
+ *map, const struct GNUNET_HashCode * key,
const void *value);
*/
int
GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value,
+ const struct GNUNET_HashCode * key, void *value,
enum GNUNET_CONTAINER_MultiHashMapOption
opt);
int
GNUNET_CONTAINER_multihashmap_get_multiple (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
GNUNET_CONTAINER_HashMapIterator it,
void *it_cls);
/**
- * @brief 0-terminated ASCII encoding of a GNUNET_HashCode.
+ * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode.
*/
struct GNUNET_CRYPTO_HashAsciiEncoded
{
* @brief IV for sym cipher
*
* NOTE: must be smaller (!) in size than the
- * GNUNET_HashCode.
+ * struct GNUNET_HashCode.
*/
struct GNUNET_CRYPTO_AesInitializationVector
{
* safely cast to char*, a '\\0' termination is set).
*/
void
-GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block,
+GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block,
struct GNUNET_CRYPTO_HashAsciiEncoded *result);
/**
- * Convert ASCII encoding back to a 'GNUNET_HashCode'
+ * Convert ASCII encoding back to a 'struct GNUNET_HashCode'
*
* @param enc the encoding
* @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
*/
int
GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
- GNUNET_HashCode * result);
+ struct GNUNET_HashCode * result);
/**
/**
- * Convert ASCII encoding back to GNUNET_HashCode
+ * Convert ASCII encoding back to struct GNUNET_HashCode
*
* @param enc the encoding
* @param result where to store the hash code
* @return number between 0 and UINT32_MAX
*/
uint32_t
-GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a,
- const GNUNET_HashCode * b);
+GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * b);
/**
* @param ret pointer to where to write the hashcode
*/
void
-GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret);
+GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret);
/**
void
GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
const void *plaintext, size_t plaintext_len,
- GNUNET_HashCode * hmac);
+ struct GNUNET_HashCode * hmac);
/**
* @param res resulting hash, NULL on error
*/
typedef void (*GNUNET_CRYPTO_HashCompletedCallback) (void *cls,
- const GNUNET_HashCode *
+ const struct GNUNET_HashCode *
res);
*/
void
GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
- GNUNET_HashCode * result);
+ struct GNUNET_HashCode * result);
/**
* @param result set to b - a
*/
void
-GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a,
- const GNUNET_HashCode * b,
- GNUNET_HashCode * result);
+GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * b,
+ struct GNUNET_HashCode * result);
/**
* @param result set to a + delta
*/
void
-GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a,
- const GNUNET_HashCode * delta,
- GNUNET_HashCode * result);
+GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * delta,
+ struct GNUNET_HashCode * result);
/**
* @param result set to a ^ b
*/
void
-GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * b,
- GNUNET_HashCode * result);
+GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_HashCode * b,
+ struct GNUNET_HashCode * result);
/**
* @param iv set to a valid initialization vector
*/
void
-GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc,
+GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc,
struct GNUNET_CRYPTO_AesSessionKey *skey,
struct GNUNET_CRYPTO_AesInitializationVector
*iv);
* @return Bit \a bit from hashcode \a code, -1 for invalid index
*/
int
-GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit);
+GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit);
/**
* Determine how many low order bits match in two
- * GNUNET_HashCodes. i.e. - 010011 and 011111 share
+ * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share
* the first two lowest order bits, and therefore the
* return value is two (NOT XOR distance, nor how many
* bits match absolutely!).
* @return the number of bits that match
*/
unsigned int
-GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first,
- const GNUNET_HashCode * second);
+GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
+ const struct GNUNET_HashCode * second);
/**
* @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
*/
int
-GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2);
+GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode * h1, const struct GNUNET_HashCode * h2);
/**
* @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
*/
int
-GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1,
- const GNUNET_HashCode * h2,
- const GNUNET_HashCode * target);
+GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1,
+ const struct GNUNET_HashCode * h2,
+ const struct GNUNET_HashCode * target);
/**
* @return some private key purely dependent on input
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
-GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc);
+GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode * hc);
/**
*/
typedef int (*GNUNET_DATACACHE_Iterator) (void *cls,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
size_t size, const char *data,
enum GNUNET_BLOCK_Type type);
*/
int
GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time);
*/
unsigned int
GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
- const GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls);
* @param size number of bytes that were made available
*/
typedef void (*GNUNET_DATACACHE_DeleteNotifyCallback) (void *cls,
- const GNUNET_HashCode *
+ const struct GNUNET_HashCode *
key, size_t size);
* @param discard_time when to discard the value in any case
* @return 0 on error, number of bytes used otherwise
*/
- size_t (*put) (void *cls, const GNUNET_HashCode * key, size_t size,
+ size_t (*put) (void *cls, const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time);
* @param iter_cls closure for iter
* @return the number of results found
*/
- unsigned int (*get) (void *cls, const GNUNET_HashCode * key,
+ unsigned int (*get) (void *cls, const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
GNUNET_DATACACHE_Iterator iter, void *iter_cls);
* @return GNUNET_OK to keep the item
* GNUNET_NO to delete the item
*/
-typedef int (*PluginDatumProcessor) (void *cls, const GNUNET_HashCode * key,
+typedef int (*PluginDatumProcessor) (void *cls, const struct GNUNET_HashCode * key,
uint32_t size, const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
* @return GNUNET_OK on success,
* GNUNET_SYSERR on failure
*/
-typedef int (*PluginPut) (void *cls, const GNUNET_HashCode * key, uint32_t size,
+typedef int (*PluginPut) (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
uint32_t replication,
* @param count how many values are stored under this key in the datastore
*/
typedef void (*PluginKeyProcessor) (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
unsigned int count);
* @param proc_cls closure for proc
*/
typedef void (*PluginGetKey) (void *cls, uint64_t offset,
- const GNUNET_HashCode * key,
- const GNUNET_HashCode * vhash,
+ const struct GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * vhash,
enum GNUNET_BLOCK_Type type,
PluginDatumProcessor proc, void *proc_cls);
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h, uint32_t rid,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const void *data, enum GNUNET_BLOCK_Type type,
uint32_t priority, uint32_t anonymity,
uint32_t replication,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
- const GNUNET_HashCode * key, size_t size,
+ const struct GNUNET_HashCode * key, size_t size,
const void *data, unsigned int queue_priority,
unsigned int max_queue_size,
struct GNUNET_TIME_Relative timeout,
* maybe 0 if no unique identifier is available
*/
typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
size_t size, const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
*/
struct GNUNET_DATASTORE_QueueEntry *
GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
enum GNUNET_BLOCK_Type type,
unsigned int queue_priority,
unsigned int max_queue_size,
* (size too big)
*/
struct GNUNET_DHT_PutHandle *
-GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key,
+GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const struct GNUNET_HashCode * key,
uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options,
enum GNUNET_BLOCK_Type type, size_t size, const char *data,
*/
typedef void (*GNUNET_DHT_GetIterator) (void *cls,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *
get_path, unsigned int get_path_length,
const struct GNUNET_PeerIdentity *
*/
struct GNUNET_DHT_GetHandle *
GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
- enum GNUNET_BLOCK_Type type, const GNUNET_HashCode * key,
+ enum GNUNET_BLOCK_Type type, const struct GNUNET_HashCode * key,
uint32_t desired_replication_level,
enum GNUNET_DHT_RouteOption options, const void *xquery,
size_t xquery_size, GNUNET_DHT_GetIterator iter,
uint32_t desired_replication_level,
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
- const GNUNET_HashCode * key);
+ const struct GNUNET_HashCode * key);
/**
* Callback called on each GET reply going through the DHT.
* put_path,
unsigned int put_path_length,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size);
unsigned int path_length,
const struct GNUNET_PeerIdentity *path,
struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const void *data,
size_t size);
struct GNUNET_DHT_MonitorHandle *
GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle,
enum GNUNET_BLOCK_Type type,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
GNUNET_DHT_MonitorGetCB get_cb,
GNUNET_DHT_MonitorGetRespCB get_resp_cb,
GNUNET_DHT_MonitorPutCB put_cb,
* @param key wherer to store the unique key
*/
void
-GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * key);
+GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode * key);
/**
* Convert a URI to a UTF-8 String.
* @return an FS URI for the given namespace and identifier
*/
struct GNUNET_FS_Uri *
-GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id);
+GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_HashCode * nsid, const char *id);
/**
*/
int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
- GNUNET_HashCode * nsid);
+ struct GNUNET_HashCode * nsid);
/**
/**
* Hash-identifier for the namespace.
*/
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
} namespace;
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filename,
- const GNUNET_HashCode * file_id);
+ const struct GNUNET_HashCode * file_id);
/**
* @param id hash identifier for the namespace
*/
typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *name,
- const GNUNET_HashCode * id);
+ const struct GNUNET_HashCode * id);
/**
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls,
- const GNUNET_HashCode * pseudonym,
+ const struct GNUNET_HashCode * pseudonym,
const char *name,
const char *unique_name,
const struct GNUNET_CONTAINER_MetaData
*/
int
GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, int delta);
+ const struct GNUNET_HashCode * nsid, int delta);
/**
* Add a pseudonym to the set of known pseudonyms.
*/
void
GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * id,
+ const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta);
*/
char *
GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix);
+ const struct GNUNET_HashCode * nsid, const char *name, unsigned int *suffix);
/**
* Get namespace name, metadata and rank
*/
int
GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
+ const struct GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
int32_t *ret_rank, char **ret_name, int *name_is_a_dup);
*/
int
GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid);
+ const char *ns_uname, struct GNUNET_HashCode * nsid);
/**
* Set the pseudonym metadata, rank and name.
*/
int
GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name,
+ const struct GNUNET_HashCode * nsid, const char *name,
const struct GNUNET_CONTAINER_MetaData *md, int rank);
/**
* Destionation of the edge.
*/
- GNUNET_HashCode destination;
+ struct GNUNET_HashCode destination;
};
/**
*/
unsigned int
GNUNET_REGEX_get_first_key (const char *input_string, unsigned int string_len,
- GNUNET_HashCode * key);
+ struct GNUNET_HashCode * key);
/**
* Check if the given 'proof' matches the given 'key'.
*/
int
GNUNET_REGEX_check_proof (const char *proof,
- const GNUNET_HashCode *key);
+ const struct GNUNET_HashCode *key);
/**
* Iterator callback function.
* @param edges edges leaving current state.
*/
typedef void (*GNUNET_REGEX_KeyIterator)(void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
const char *proof,
int accepting,
unsigned int num_edges,
int result_af,
uint8_t protocol,
const struct GNUNET_PeerIdentity *peer,
- const GNUNET_HashCode *serv,
+ const struct GNUNET_HashCode *serv,
int nac,
struct GNUNET_TIME_Absolute expiration_time,
GNUNET_VPN_AllocationCallback cb,
static int
map_check_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
int *fail = cls;
static int
map_cleanup_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct PeerContainer *pc = value;
int map_ping_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct PeerContainer *pc = value;
* GNUNET_NO if not.
*/
static int
-match_iterator (void *cls, const GNUNET_HashCode *key, void *value)
+match_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
{
struct LockMatch *match = cls;
struct Lock *lock = value;
*/
static int
lock_delete_iterator (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct Lock *lock = value;
* GNUNET_NO if not.
*/
static int
-match_iterator (void *cls, const GNUNET_HashCode *key, void *value)
+match_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
{
struct LockingRequestMatch *match = cls;
struct GNUNET_LOCKMANAGER_LockingRequest *lr = value;
*/
static int
release_iterator(void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct GNUNET_LOCKMANAGER_Handle *h = cls;
*/
static int
free_iterator(void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct GNUNET_LOCKMANAGER_Handle *h = cls;
* GNUNET_NO if not.
*/
static int
-announce_application (void *cls, const GNUNET_HashCode * key, void *value)
+announce_application (void *cls, const struct GNUNET_HashCode * key, void *value)
{
/* FIXME are hashes in multihash map equal on all aquitectures? */
/* FIXME: keep return value of 'put' to possibly cancel!? */
*/
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
static int
client_is_subscribed (uint16_t message_type, struct MeshClient *c)
{
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
GNUNET_CRYPTO_hash (&message_type, sizeof (uint16_t), &hc);
return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc);
static void
client_ignore_tunnel (struct MeshClient *c, struct MeshTunnel *t)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash(&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash);
GNUNET_break (GNUNET_YES ==
static void
client_delete_tunnel (struct MeshClient *c, struct MeshTunnel *t)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
if (c == t->owner)
{
{
/* This client doesn't know the tunnel */
struct GNUNET_MESH_TunnelNotification tmsg;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
tmsg.header.size = htons (sizeof (tmsg));
tmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
* @return always GNUNET_YES, to keep iterating
*/
static int
-peer_info_delete_tunnel (void *cls, const GNUNET_HashCode * key, void *value)
+peer_info_delete_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = cls;
struct MeshPeerInfo *peer = value;
}
else
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
path_destroy (p);
send_client_peer_connected (t, myid);
static struct MeshTunnel *
tunnel_get_incoming (MESH_TunnelNumber tid)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_assert (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV);
GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash);
}
else
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash);
return GNUNET_CONTAINER_multihashmap_get (c->own_tunnels, &hash);
tunnel_get_by_pi (GNUNET_PEER_Id pi, MESH_TunnelNumber tid)
{
struct MESH_TunnelID id;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
id.oid = pi;
id.tid = tid;
tunnel_destroy (struct MeshTunnel *t)
{
struct MeshClient *c;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
unsigned int i;
int r;
* @return GNUNET_OK on success
*/
static int
-tunnel_destroy_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = value;
struct MeshClient *c = cls;
MESH_TunnelNumber tid;
struct GNUNET_MESH_ManipulatePath *msg;
struct GNUNET_PeerIdentity *pi;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
struct MeshPeerPath *path;
struct MeshPeerInfo *dest_peer_info;
struct MeshPeerInfo *orig_peer_info;
* @return GNUNET_OK on success
*/
static int
-deregister_app (void *cls, const GNUNET_HashCode * key, void *value)
+deregister_app (void *cls, const struct GNUNET_HashCode * key, void *value)
{
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (applications, key,
*/
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
*/
static void
dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
if (napps > 0)
{
GNUNET_MESH_ApplicationType at;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
c->apps = GNUNET_CONTAINER_multihashmap_create (napps);
for (i = 0; i < napps; i++)
if (ntypes > 0)
{
uint16_t u16;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
t = (uint16_t *) & a[napps];
c->types = GNUNET_CONTAINER_multihashmap_create (ntypes);
struct GNUNET_MESH_ConnectPeerByType *connect_msg;
struct MeshClient *c;
struct MeshTunnel *t;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
MESH_TunnelNumber tid;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got connect by type request\n");
* GNUNET_NO if not.
*/
static int
-shutdown_tunnel (void *cls, const GNUNET_HashCode * key, void *value)
+shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = value;
* GNUNET_NO if not.
*/
static int
-shutdown_peer (void *cls, const GNUNET_HashCode * key, void *value)
+shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshPeerInfo *p = value;
struct MeshPeerQueue *q;
* GNUNET_NO if not.
*/
static int
-announce_application (void *cls, const GNUNET_HashCode * key, void *value)
+announce_application (void *cls, const struct GNUNET_HashCode * key, void *value)
{
/* FIXME are hashes in multihash map equal on all aquitectures? */
/* FIXME: keep return value of 'put' to possibly cancel!? */
*/
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
static int
client_is_subscribed (uint16_t message_type, struct MeshClient *c)
{
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
GNUNET_CRYPTO_hash (&message_type, sizeof (uint16_t), &hc);
return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc);
static void
client_ignore_tunnel (struct MeshClient *c, struct MeshTunnel *t)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash(&t->local_tid_dest, sizeof (MESH_TunnelNumber), &hash);
GNUNET_break (GNUNET_YES ==
static void
client_delete_tunnel (struct MeshClient *c, struct MeshTunnel *t)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
if (c == t->owner)
{
{
/* This client doesn't know the tunnel */
struct GNUNET_MESH_TunnelNotification tmsg;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
tmsg.header.size = htons (sizeof (tmsg));
tmsg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
* @return always GNUNET_YES, to keep iterating
*/
static int
-peer_info_delete_tunnel (void *cls, const GNUNET_HashCode * key, void *value)
+peer_info_delete_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = cls;
struct MeshPeerInfo *peer = value;
}
else
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
path_destroy (p);
send_client_peer_connected (t, myid);
static struct MeshTunnel *
tunnel_get_incoming (MESH_TunnelNumber tid)
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_assert (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV);
GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash);
}
else
{
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash (&tid, sizeof (MESH_TunnelNumber), &hash);
return GNUNET_CONTAINER_multihashmap_get (c->own_tunnels, &hash);
tunnel_get_by_pi (GNUNET_PEER_Id pi, MESH_TunnelNumber tid)
{
struct MESH_TunnelID id;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
id.oid = pi;
id.tid = tid;
tunnel_destroy (struct MeshTunnel *t)
{
struct MeshClient *c;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
unsigned int i;
int r;
* @return GNUNET_OK on success
*/
static int
-tunnel_destroy_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+tunnel_destroy_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = value;
struct MeshClient *c = cls;
MESH_TunnelNumber tid;
struct GNUNET_MESH_ManipulatePath *msg;
struct GNUNET_PeerIdentity *pi;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
struct MeshPeerPath *path;
struct MeshPeerInfo *dest_peer_info;
struct MeshPeerInfo *orig_peer_info;
* @return GNUNET_OK on success
*/
static int
-deregister_app (void *cls, const GNUNET_HashCode * key, void *value)
+deregister_app (void *cls, const struct GNUNET_HashCode * key, void *value)
{
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (applications, key,
*/
static void
dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
*/
static void
dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
const struct GNUNET_PeerIdentity *get_path,
unsigned int get_path_length,
const struct GNUNET_PeerIdentity *put_path,
if (napps > 0)
{
GNUNET_MESH_ApplicationType at;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
c->apps = GNUNET_CONTAINER_multihashmap_create (napps);
for (i = 0; i < napps; i++)
if (ntypes > 0)
{
uint16_t u16;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
t = (uint16_t *) & a[napps];
c->types = GNUNET_CONTAINER_multihashmap_create (ntypes);
struct GNUNET_MESH_ConnectPeerByType *connect_msg;
struct MeshClient *c;
struct MeshTunnel *t;
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
MESH_TunnelNumber tid;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "got connect by type request\n");
* GNUNET_NO if not.
*/
static int
-shutdown_tunnel (void *cls, const GNUNET_HashCode * key, void *value)
+shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshTunnel *t = value;
* GNUNET_NO if not.
*/
static int
-shutdown_peer (void *cls, const GNUNET_HashCode * key, void *value)
+shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MeshPeerInfo *p = value;
struct MeshPeerQueue *q;
* @return GNUNET_YES if we should continue to iterate, GNUNET_NO if not.
*/
static int
-iterate_free (void *cls, const GNUNET_HashCode * key, void *value)
+iterate_free (void *cls, const struct GNUNET_HashCode * key, void *value)
{
GNUNET_free (value);
return GNUNET_YES;
}
int zone_to_disk_it (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct GNUNET_NAMESTORE_CryptoContainer * c = value;
struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
struct GNUNET_TIME_Absolute e;
struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
- GNUNET_HashCode long_hash;
+ struct GNUNET_HashCode long_hash;
char *rd_tmp;
char *name_tmp;
size_t rd_ser_len;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
struct RecordCreateResponseMessage rcr_msg;
struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
- GNUNET_HashCode long_hash;
+ struct GNUNET_HashCode long_hash;
size_t name_len;
size_t msg_size;
size_t msg_size_exp;
struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
- GNUNET_HashCode long_hash;
+ struct GNUNET_HashCode long_hash;
char * pkey_tmp = NULL;
char * name_tmp = NULL;
char * rd_ser = NULL;
struct GNUNET_CRYPTO_RsaSignature * new_signature;
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_CRYPTO_ShortHashCode hash;
- GNUNET_HashCode long_hash;
+ struct GNUNET_HashCode long_hash;
struct GNUNET_TIME_Absolute e;
unsigned int rd_count_filtered = 0;
int include;
int zonekey_file_it (void *cls, const char *filename)
{
- GNUNET_HashCode long_hash;
+ struct GNUNET_HashCode long_hash;
int *counter = cls;
if ((filename != NULL) && (NULL != strstr(filename, ".zkey")))
{
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_HashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_rd;
static char *s_name;
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_HashCode zone;
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
-static GNUNET_HashCode zone2;
+static struct GNUNET_HashCode zone2;
static struct GNUNET_NAMESTORE_ZoneIterator *zi;
static int res;
/* verify signature returned from name store */
if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (zone_key, expire, name, rd_count, rd, signature))
{
- GNUNET_HashCode zone_key_hash;
+ struct GNUNET_HashCode zone_key_hash;
GNUNET_CRYPTO_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Verifying signature for `%s' in zone `%s' with %u records and expiration %llu failed\n", name, GNUNET_h2s(&zone_key_hash), rd_count, expire.abs_value);
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_HashCode zone;
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
-static GNUNET_HashCode zone2;
+static struct GNUNET_HashCode zone2;
static struct GNUNET_NAMESTORE_ZoneIterator *zi;
static int res;
get_matching_bits (struct GNUNET_TIME_Absolute timestamp,
const struct GNUNET_PeerIdentity *id)
{
- GNUNET_HashCode timestamp_hash;
+ struct GNUNET_HashCode timestamp_hash;
GNUNET_CRYPTO_hash (×tamp.abs_value, sizeof (timestamp.abs_value),
×tamp_hash);
* @return GNUNET_OK (continue to iterate)
*/
static int
-schedule_current_round (void *cls, const GNUNET_HashCode * key, void *value)
+schedule_current_round (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NSEPeerEntry *peer_entry = value;
struct GNUNET_TIME_Relative delay;
* @return the number of leading zero bits.
*/
static unsigned int
-count_leading_zeroes (const GNUNET_HashCode * hash)
+count_leading_zeroes (const struct GNUNET_HashCode * hash)
{
unsigned int hash_count;
{
char buf[sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) +
sizeof (val)] GNUNET_ALIGN;
- GNUNET_HashCode result;
+ struct GNUNET_HashCode result;
memcpy (buf, &val, sizeof (val));
memcpy (&buf[sizeof (val)], pkey,
uint64_t counter;
char buf[sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) +
sizeof (uint64_t)] GNUNET_ALIGN;
- GNUNET_HashCode result;
+ struct GNUNET_HashCode result;
unsigned int i;
proof_task = GNUNET_SCHEDULER_NO_TASK;
* @return GNUNET_OK (continue to iterate)
*/
static int
-update_flood_times (void *cls, const GNUNET_HashCode * key, void *value)
+update_flood_times (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NSEPeerEntry *exclude = cls;
struct NSEPeerEntry *peer_entry = value;
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (nse_work_required >= sizeof (GNUNET_HashCode) * 8)
+ if (nse_work_required >= sizeof (struct GNUNET_HashCode) * 8)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Invalid work requirement for NSE service. Exiting.\n"));
* @return GNUNET_YES (continue to iterate)
*/
static int
-add_to_tc (void *cls, const GNUNET_HashCode * key, void *value)
+add_to_tc (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_SERVER_TransmitContext *tc = cls;
struct HostEntry *pos = value;
* FIXME.
*/
static int
-do_notify_entry (void *cls, const GNUNET_HashCode * key, void *value)
+do_notify_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_SERVER_Client *client = cls;
struct HostEntry *he = value;
* FIXME.
*/
static int
-free_host_entry (void *cls, const GNUNET_HashCode * key, void *value)
+free_host_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct HostEntry *he = value;
/**
* Hash of the state.
*/
- GNUNET_HashCode hash;
+ struct GNUNET_HashCode hash;
/**
* Proof for this state.
*/
unsigned int
GNUNET_REGEX_get_first_key (const char *input_string, unsigned int string_len,
- GNUNET_HashCode * key)
+ struct GNUNET_HashCode * key)
{
unsigned int size;
* @return GNUNET_OK if the proof is valid for the given key
*/
int
-GNUNET_REGEX_check_proof (const char *proof, const GNUNET_HashCode * key)
+GNUNET_REGEX_check_proof (const char *proof, const struct GNUNET_HashCode * key)
{
return GNUNET_OK;
}
#include "gnunet_regex_lib.h"
void
-key_iterator (void *cls, const GNUNET_HashCode * key, const char *proof,
+key_iterator (void *cls, const struct GNUNET_HashCode * key, const char *proof,
int accepting, unsigned int num_edges,
const struct GNUNET_REGEX_Edge *edges)
{
* @param hash set to uid (extended with zeros)
*/
static void
-hash_from_uid (uint32_t uid, GNUNET_HashCode * hash)
+hash_from_uid (uint32_t uid, struct GNUNET_HashCode * hash)
{
- memset (hash, 0, sizeof (GNUNET_HashCode));
+ memset (hash, 0, sizeof (struct GNUNET_HashCode));
*((uint32_t *) hash) = uid;
}
* @param hash set to uid (extended with zeros)
*/
static void
-uid_from_hash (const GNUNET_HashCode * hash, uint32_t * uid)
+uid_from_hash (const struct GNUNET_HashCode * hash, uint32_t * uid)
{
memcpy (uid, hash, sizeof (uint32_t));
}
struct PeerConnection **second_tail;
#else
- GNUNET_HashCode hash_first;
- GNUNET_HashCode hash_second;
+ struct GNUNET_HashCode hash_first;
+ struct GNUNET_HashCode hash_second;
hash_from_uid (first, &hash_first);
hash_from_uid (second, &hash_second);
* GNUNET_NO if not.
*/
static int
-unblacklist_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+unblacklist_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct UnblacklistContext *un_ctx = cls;
uint32_t second_pos;
* "fixing" now.
*/
static int
-friend_file_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+friend_file_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
FILE *temp_friend_handle = cls;
struct GNUNET_TESTING_Daemon *peer = value;
* @return GNUNET_YES to continue iteration
*/
static int
-blacklist_file_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+blacklist_file_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct BlacklistContext *blacklist_ctx = cls;
struct GNUNET_TESTING_Daemon *peer = value;
* @return GNUNET_YES to continue iteration
*/
static int
-connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+connect_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ConnectTopologyContext *ct_ctx = cls;
struct PeerData *first = ct_ctx->first;
* @return GNUNET_YES to continue iteration
*/
static int
-copy_topology_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+copy_topology_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct PeerData *first = cls;
* @return GNUNET_YES to continue iteration
*/
static int
-random_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+random_connect_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct RandomContext *random_ctx = cls;
double random_number;
uint32_t second_pos;
- GNUNET_HashCode first_hash;
+ struct GNUNET_HashCode first_hash;
random_number =
((double)
* @return GNUNET_YES to continue iteration
*/
static int
-minimum_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+minimum_connect_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct MinimumContext *min_ctx = cls;
uint32_t second_pos;
- GNUNET_HashCode first_hash;
+ struct GNUNET_HashCode first_hash;
unsigned int i;
if (GNUNET_CONTAINER_multihashmap_size
* @return GNUNET_YES to continue iteration
*/
static int
-dfs_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value)
+dfs_connect_iterator (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct DFSContext *dfs_ctx = cls;
- GNUNET_HashCode first_hash;
+ struct GNUNET_HashCode first_hash;
if (dfs_ctx->current == dfs_ctx->chosen)
{
* GNUNET_NO if not.
*/
static int
-find_closest_peers (void *cls, const GNUNET_HashCode * key, void *value)
+find_closest_peers (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct FindClosestContext *closest_ctx = cls;
struct GNUNET_TESTING_Daemon *daemon = value;
struct PeerConnection *peer_iter;
#else
struct DFSContext dfs_ctx;
- GNUNET_HashCode second_hash;
+ struct GNUNET_HashCode second_hash;
#endif
#if OLD
* @return GNUNET_YES (always: continue to iterate)
*/
static int
-free_peer (void *cls, const GNUNET_HashCode * pid, void *value)
+free_peer (void *cls, const struct GNUNET_HashCode * pid, void *value)
{
struct Peer *pos = value;
* @return GNUNET_YES (continue iteration)
*/
static int
-find_advertisable_hello (void *cls, const GNUNET_HashCode * pid, void *value)
+find_advertisable_hello (void *cls, const struct GNUNET_HashCode * pid, void *value)
{
struct FindAdvHelloContext *fah = cls;
struct Peer *pos = value;
* @return GNUNET_YES (always)
*/
static int
-reschedule_hellos (void *cls, const GNUNET_HashCode * pid, void *value)
+reschedule_hellos (void *cls, const struct GNUNET_HashCode * pid, void *value)
{
struct Peer *peer = value;
struct Peer *skip = cls;
* @return GNUNET_YES (continue to iterate)
*/
static int
-try_add_peers (void *cls, const GNUNET_HashCode * pid, void *value)
+try_add_peers (void *cls, const struct GNUNET_HashCode * pid, void *value)
{
struct Peer *pos = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-free_blacklist_entry (void *cls, const GNUNET_HashCode * key, void *value)
+free_blacklist_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
{
char *be = value;
* @return GNUNET_OK if the entry does not match, GNUNET_NO if it matches
*/
static int
-test_blacklisted (void *cls, const GNUNET_HashCode * key, void *value)
+test_blacklisted (void *cls, const struct GNUNET_HashCode * key, void *value)
{
const char *transport_name = cls;
char *be = value;
{
struct NeighbourMapEntry *n;
const struct SessionDisconnectMessage *sdm;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received DISCONNECT message from peer `%s'\n",
* @return GNUNET_OK (continue to iterate)
*/
static int
-neighbours_iterate (void *cls, const GNUNET_HashCode * key, void *value)
+neighbours_iterate (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct IteratorContext *ic = cls;
struct NeighbourMapEntry *n = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-disconnect_all_neighbours (void *cls, const GNUNET_HashCode * key, void *value)
+disconnect_all_neighbours (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct NeighbourMapEntry *n = value;
* GNUNET_NO if the entry does match
*/
static int
-validation_entry_match (void *cls, const GNUNET_HashCode * key, void *value)
+validation_entry_match (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ValidationEntryMatchContext *vemc = cls;
struct ValidationEntry *ve = value;
* @return GNUNET_YES (continue to iterate)
*/
static int
-cleanup_validation_entry (void *cls, const GNUNET_HashCode * key, void *value)
+cleanup_validation_entry (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct ValidationEntry *ve = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-iterate_addresses (void *cls, const GNUNET_HashCode * key, void *value)
+iterate_addresses (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct IteratorContext *ic = cls;
struct ValidationEntry *ve = value;
static int
session_lookup_by_client_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct SessionClientCtx *sc_ctx = cls;
static int
session_lookup_it (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct SessionItCtx * si_ctx = cls;
static int
session_disconnect_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct Session *session = value;
* @return GNUNET_OK (continue to iterate)
*/
static int
-disconnect_and_free_it (void *cls, const GNUNET_HashCode * key, void *value)
+disconnect_and_free_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
disconnect_session(value);
return GNUNET_OK;
static int
session_cmp_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct SessionCompareContext * cctx = cls;
static int
-lookup_session_by_addr_it (void *cls, const GNUNET_HashCode * key, void *value)
+lookup_session_by_addr_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct LookupContext *l_ctx = cls;
struct Session * s = value;
};
int lookup_session_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct LookupCtx *lctx = cls;
}
static int
-get_session_delete_it (void *cls, const GNUNET_HashCode * key, void *value)
+get_session_delete_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct Session *s = value;
disconnect_session (s);
static int
-get_session_it (void *cls, const GNUNET_HashCode * key, void *value)
+get_session_it (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct gsi_ctx *gsi = cls;
struct Session *s = value;
* GNUNET_NO if not.
*/
static int
-neighbour_delete (void *cls, const GNUNET_HashCode * key, void *value)
+neighbour_delete (void *cls, const struct GNUNET_HashCode * key, void *value)
{
struct GNUNET_TRANSPORT_Handle *handle = cls;
struct Neighbour *n = value;
* @return string form; will be overwritten by next call to GNUNET_h2s.
*/
const char *
-GNUNET_h2s (const GNUNET_HashCode * hc)
+GNUNET_h2s (const struct GNUNET_HashCode * hc)
{
static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
* @return string form; will be overwritten by next call to GNUNET_h2s_full.
*/
const char *
-GNUNET_h2s_full (const GNUNET_HashCode * hc)
+GNUNET_h2s_full (const struct GNUNET_HashCode * hc)
{
static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
*/
static void
iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf,
- BitIterator callback, void *arg, const GNUNET_HashCode * key)
+ BitIterator callback, void *arg, const struct GNUNET_HashCode * key)
{
- GNUNET_HashCode tmp[2];
+ struct GNUNET_HashCode tmp[2];
int bitCount;
unsigned int round;
unsigned int slot = 0;
GNUNET_assert (bf->bitArraySize * 8LL > bf->bitArraySize);
while (bitCount > 0)
{
- while (slot < (sizeof (GNUNET_HashCode) / sizeof (uint32_t)))
+ while (slot < (sizeof (struct GNUNET_HashCode) / sizeof (uint32_t)))
{
if (GNUNET_YES !=
callback (arg, bf,
}
if (bitCount > 0)
{
- GNUNET_CRYPTO_hash (&tmp[round & 1], sizeof (GNUNET_HashCode),
+ GNUNET_CRYPTO_hash (&tmp[round & 1], sizeof (struct GNUNET_HashCode),
&tmp[(round + 1) & 1]);
round++;
slot = 0;
*/
int
GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
- *bf, const GNUNET_HashCode * e)
+ *bf, const struct GNUNET_HashCode * e)
{
int res;
*/
void
GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e)
+ const struct GNUNET_HashCode * e)
{
if (NULL == bf)
return;
*/
void
GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e)
+ const struct GNUNET_HashCode * e)
{
if (NULL == bf)
return;
void *iterator_cls, size_t size,
unsigned int k)
{
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
unsigned int i;
GNUNET_free (bf->bitArray);
/**
* Key for the entry.
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Value of the entry.
*/
static unsigned int
idx_of (const struct GNUNET_CONTAINER_MultiHashMap *m,
- const GNUNET_HashCode * key)
+ const struct GNUNET_HashCode * key)
{
GNUNET_assert (m != NULL);
return (*(unsigned int *) key) % m->map_length;
*/
void *
GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key)
+ *map, const struct GNUNET_HashCode * key)
{
struct MapEntry *e;
e = map->map[idx_of (map, key)];
while (e != NULL)
{
- if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
return e->value;
e = e->next;
}
unsigned int i;
struct MapEntry *e;
struct MapEntry *n;
- GNUNET_HashCode kc;
+ struct GNUNET_HashCode kc;
count = 0;
GNUNET_assert (map != NULL);
*/
int
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value)
+ const struct GNUNET_HashCode * key, void *value)
{
struct MapEntry *e;
struct MapEntry *p;
e = map->map[i];
while (e != NULL)
{
- if ((0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode))) &&
(value == e->value))
{
if (p == NULL)
*/
int
GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key)
+ *map, const struct GNUNET_HashCode * key)
{
struct MapEntry *e;
struct MapEntry *p;
e = map->map[i];
while (e != NULL)
{
- if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
{
if (p == NULL)
map->map[i] = e->next;
int
GNUNET_CONTAINER_multihashmap_contains (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key)
+ const struct GNUNET_HashCode * key)
{
struct MapEntry *e;
e = map->map[idx_of (map, key)];
while (e != NULL)
{
- if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
return GNUNET_YES;
e = e->next;
}
int
GNUNET_CONTAINER_multihashmap_contains_value (const struct
GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key,
+ *map, const struct GNUNET_HashCode * key,
const void *value)
{
struct MapEntry *e;
e = map->map[idx_of (map, key)];
while (e != NULL)
{
- if ((0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode))) &&
(e->value == value))
return GNUNET_YES;
e = e->next;
*/
int
GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value,
+ const struct GNUNET_HashCode * key, void *value,
enum GNUNET_CONTAINER_MultiHashMapOption opt)
{
struct MapEntry *e;
e = map->map[i];
while (e != NULL)
{
- if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
{
if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
return GNUNET_SYSERR;
int
GNUNET_CONTAINER_multihashmap_get_multiple (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
GNUNET_CONTAINER_HashMapIterator it,
void *it_cls)
{
while (NULL != (e = n))
{
n = e->next;
- if (0 != memcmp (key, &e->key, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
continue;
if ((it != NULL) && (GNUNET_OK != it (it_cls, key, e->value)))
return GNUNET_SYSERR;
* @param ret pointer to where to write the hashcode
*/
void
-GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret)
+GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret)
{
gcry_md_hash_buffer (GCRY_MD_SHA512, ret, block, size);
}
*/
static void
file_hash_finish (struct GNUNET_CRYPTO_FileHashContext *fhc,
- const GNUNET_HashCode * res)
+ const struct GNUNET_HashCode * res)
{
fhc->callback (fhc->callback_cls, res);
GNUNET_free (fhc->filename);
file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CRYPTO_FileHashContext *fhc = cls;
- GNUNET_HashCode *res;
+ struct GNUNET_HashCode *res;
size_t delta;
fhc->task = GNUNET_SCHEDULER_NO_TASK;
fhc->offset += delta;
if (fhc->offset == fhc->fsize)
{
- res = (GNUNET_HashCode *) gcry_md_read (fhc->md, GCRY_MD_SHA512);
+ res = (struct GNUNET_HashCode *) gcry_md_read (fhc->md, GCRY_MD_SHA512);
file_hash_finish (fhc, res);
return;
}
* safely cast to char*, a '\\0' termination is set).
*/
void
-GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block,
+GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block,
struct GNUNET_CRYPTO_HashAsciiEncoded *result)
{
char *np;
*/
int
GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
- GNUNET_HashCode * result)
+ struct GNUNET_HashCode * result)
{
char upper_enc[enclen];
char* up_ptr = upper_enc;
* hashcode proximity.
*/
unsigned int
-GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a,
- const GNUNET_HashCode * b)
+GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * b)
{
unsigned int x1 = (a->bits[1] - b->bits[1]) >> 16;
unsigned int x2 = (b->bits[1] - a->bits[1]) >> 16;
*/
void
GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
- GNUNET_HashCode * result)
+ struct GNUNET_HashCode * result)
{
int i;
- for (i = (sizeof (GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; i--)
+ for (i = (sizeof (struct GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; i--)
result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, UINT32_MAX);
}
* @param result set to b - a
*/
void
-GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a,
- const GNUNET_HashCode * b,
- GNUNET_HashCode * result)
+GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * b,
+ struct GNUNET_HashCode * result)
{
int i;
- for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
+ for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
result->bits[i] = b->bits[i] - a->bits[i];
}
* @param result set to a + delta
*/
void
-GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a,
- const GNUNET_HashCode * delta, GNUNET_HashCode * result)
+GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a,
+ const struct GNUNET_HashCode * delta, struct GNUNET_HashCode * result)
{
int i;
- for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
+ for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
result->bits[i] = delta->bits[i] + a->bits[i];
}
* @param result set to a ^ b
*/
void
-GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * b,
- GNUNET_HashCode * result)
+GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_HashCode * b,
+ struct GNUNET_HashCode * result)
{
int i;
- for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
+ for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
result->bits[i] = a->bits[i] ^ b->bits[i];
}
* @param iv set to a valid initialization vector
*/
void
-GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc,
+GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc,
struct GNUNET_CRYPTO_AesSessionKey *skey,
struct GNUNET_CRYPTO_AesInitializationVector *iv)
{
- GNUNET_assert (sizeof (GNUNET_HashCode) >=
+ GNUNET_assert (sizeof (struct GNUNET_HashCode) >=
GNUNET_CRYPTO_AES_KEY_LENGTH +
sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH);
* @return Bit \a bit from hashcode \a code, -1 for invalid index
*/
int
-GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit)
+GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit)
{
- GNUNET_assert (bit < 8 * sizeof (GNUNET_HashCode));
+ GNUNET_assert (bit < 8 * sizeof (struct GNUNET_HashCode));
return (((unsigned char *) code)[bit >> 3] & (1 << (bit & 7))) > 0;
}
/**
* Determine how many low order bits match in two
- * GNUNET_HashCodes. i.e. - 010011 and 011111 share
+ * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share
* the first two lowest order bits, and therefore the
* return value is two (NOT XOR distance, nor how many
* bits match absolutely!).
* @return the number of bits that match
*/
unsigned int
-GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first,
- const GNUNET_HashCode * second)
+GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
+ const struct GNUNET_HashCode * second)
{
unsigned int i;
- for (i = 0; i < sizeof (GNUNET_HashCode) * 8; i++)
+ for (i = 0; i < sizeof (struct GNUNET_HashCode) * 8; i++)
if (GNUNET_CRYPTO_hash_get_bit (first, i) !=
GNUNET_CRYPTO_hash_get_bit (second, i))
return i;
- return sizeof (GNUNET_HashCode) * 8;
+ return sizeof (struct GNUNET_HashCode) * 8;
}
* @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
*/
int
-GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2)
+GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode * h1, const struct GNUNET_HashCode * h2)
{
unsigned int *i1;
unsigned int *i2;
i1 = (unsigned int *) h1;
i2 = (unsigned int *) h2;
- for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
+ for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
{
if (i1[i] > i2[i])
return 1;
* @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
*/
int
-GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1,
- const GNUNET_HashCode * h2,
- const GNUNET_HashCode * target)
+GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1,
+ const struct GNUNET_HashCode * h2,
+ const struct GNUNET_HashCode * target)
{
int i;
unsigned int d1;
unsigned int d2;
- for (i = sizeof (GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--)
+ for (i = sizeof (struct GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--)
{
d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i];
d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i];
void
GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
const void *plaintext, size_t plaintext_len,
- GNUNET_HashCode * hmac)
+ struct GNUNET_HashCode * hmac)
{
gcry_md_hd_t md;
const unsigned char *mc;
static void
-mpz_randomize (gcry_mpi_t n, unsigned int nbits, GNUNET_HashCode * rnd)
+mpz_randomize (gcry_mpi_t n, unsigned int nbits, struct GNUNET_HashCode * rnd)
{
- GNUNET_HashCode hc;
- GNUNET_HashCode tmp;
- int bits_per_hc = sizeof (GNUNET_HashCode) * 8;
+ struct GNUNET_HashCode hc;
+ struct GNUNET_HashCode tmp;
+ int bits_per_hc = sizeof (struct GNUNET_HashCode) * 8;
int cnt;
int i;
int j;
if (i > 0)
- GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), &tmp);
- for (j = 0; j < sizeof (GNUNET_HashCode) / sizeof (uint32_t); j++)
+ GNUNET_CRYPTO_hash (&hc, sizeof (struct GNUNET_HashCode), &tmp);
+ for (j = 0; j < sizeof (struct GNUNET_HashCode) / sizeof (uint32_t); j++)
{
#if HAVE_GCRY_MPI_LSHIFT
gcry_mpi_lshift (n, n, sizeof (uint32_t) * 8);
}
hc = tmp;
}
- GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), rnd);
+ GNUNET_CRYPTO_hash (&hc, sizeof (struct GNUNET_HashCode), rnd);
i = gcry_mpi_get_nbits (n);
while (i > nbits)
gcry_mpi_clear_bit (n, --i);
* Return true if n is probably a prime
*/
static int
-is_prime (gcry_mpi_t n, int steps, GNUNET_HashCode * hc)
+is_prime (gcry_mpi_t n, int steps, struct GNUNET_HashCode * hc)
{
gcry_mpi_t x;
gcry_mpi_t y;
static void
-gen_prime (gcry_mpi_t * ptest, unsigned int nbits, GNUNET_HashCode * hc)
+gen_prime (gcry_mpi_t * ptest, unsigned int nbits, struct GNUNET_HashCode * hc)
{
/* Note: 2 is not included because it can be tested more easily by
* looking at bit 0. The last entry in this list is marked by a zero */
*/
static void
generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits,
- GNUNET_HashCode * hc)
+ struct GNUNET_HashCode * hc)
{
gcry_mpi_t t1, t2;
gcry_mpi_t phi; /* helper: (p-1)(q-1) */
* given HashCode as input to the PRNG.
*/
static struct KskRsaPrivateKeyBinaryEncoded *
-makeKblockKeyInternal (const GNUNET_HashCode * hc)
+makeKblockKeyInternal (const struct GNUNET_HashCode * hc)
{
KBlock_secret_key sk;
- GNUNET_HashCode hx;
+ struct GNUNET_HashCode hx;
unsigned char *pbu[6];
gcry_mpi_t *pkv[6];
size_t sizes[6];
/**
* Hash from which the key was generated.
*/
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
/**
* The encoded key.
* @return corresponding private key; must not be freed!
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
-GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc)
+GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode * hc)
{
struct KBlockKeyCacheLine *line;
unsigned int i;
for (i = 0; i < cacheSize; i++)
- if (0 == memcmp (hc, &cache[i]->hc, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (hc, &cache[i]->hc, sizeof (struct GNUNET_HashCode)))
return GNUNET_CRYPTO_rsa_decode_key ((const char*) cache[i]->pke,
ntohs (cache[i]->pke->len));
line = GNUNET_malloc (sizeof (struct KBlockKeyCacheLine));
size_t isize;
size_t erroff;
- GNUNET_assert (size <= sizeof (GNUNET_HashCode));
+ GNUNET_assert (size <= sizeof (struct GNUNET_HashCode));
pubkey = public2PrivateKey (publicKey);
if (pubkey == NULL)
return GNUNET_SYSERR;
gcry_sexp_t data;
size_t ssize;
gcry_mpi_t rval;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
char *buff;
int bufSize;
[bufSize -
strlen
("0123456789012345678901234567890123456789012345678901234567890123))")
- - 1], &hc, sizeof (GNUNET_HashCode));
+ - 1], &hc, sizeof (struct GNUNET_HashCode));
GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
GNUNET_free (buff);
GNUNET_assert (0 == gcry_pk_sign (&result, data, key->sexp));
size_t size;
gcry_mpi_t val;
struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
- GNUNET_HashCode hc;
+ struct GNUNET_HashCode hc;
char *buff;
int bufSize;
size_t erroff;
[strlen (FORMATSTRING) -
strlen
("0123456789012345678901234567890123456789012345678901234567890123))")],
- &hc, sizeof (GNUNET_HashCode));
+ &hc, sizeof (struct GNUNET_HashCode));
GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
GNUNET_free (buff);
hostkey = public2PrivateKey (publicKey);
static void
perfHash ()
{
- GNUNET_HashCode hc1;
- GNUNET_HashCode hc2;
- GNUNET_HashCode hc3;
+ struct GNUNET_HashCode hc1;
+ struct GNUNET_HashCode hc2;
+ struct GNUNET_HashCode hc3;
int i;
char *buf;
GNUNET_CRYPTO_hash ("foo", 3, &hc1);
for (i = 0; i < 1024; i++)
{
- GNUNET_CRYPTO_hash (&hc1, sizeof (GNUNET_HashCode), &hc2);
- GNUNET_CRYPTO_hash (&hc2, sizeof (GNUNET_HashCode), &hc1);
+ GNUNET_CRYPTO_hash (&hc1, sizeof (struct GNUNET_HashCode), &hc2);
+ GNUNET_CRYPTO_hash (&hc2, sizeof (struct GNUNET_HashCode), &hc1);
GNUNET_CRYPTO_hash (buf, 1024 * 64, &hc3);
}
GNUNET_free (buf);
* @param rating rating of pseudonym
*/
static void
-internal_notify (const GNUNET_HashCode * id,
+internal_notify (const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
struct DiscoveryCallback *pos;
*/
static char *
get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *prefix, const GNUNET_HashCode * psid)
+ const char *prefix, const struct GNUNET_HashCode * psid)
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
*/
static void
write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid,
+ const struct GNUNET_HashCode * nsid,
const struct GNUNET_CONTAINER_MetaData *meta,
int32_t ranking, const char *ns_name)
{
*/
static int
read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid,
+ const struct GNUNET_HashCode * nsid,
struct GNUNET_CONTAINER_MetaData **meta, int32_t * ranking,
char **ns_name)
{
*/
char *
GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix)
+ const struct GNUNET_HashCode * nsid, const char *name, unsigned int *suffix)
{
- GNUNET_HashCode nh;
+ struct GNUNET_HashCode nh;
uint64_t len;
char *fn;
struct GNUNET_DISK_FileHandle *fh;
GNUNET_DISK_PERM_USER_WRITE);
i = 0;
idx = -1;
- while ((len >= sizeof (GNUNET_HashCode)) &&
- (sizeof (GNUNET_HashCode) ==
- GNUNET_DISK_file_read (fh, &nh, sizeof (GNUNET_HashCode))))
+ while ((len >= sizeof (struct GNUNET_HashCode)) &&
+ (sizeof (struct GNUNET_HashCode) ==
+ GNUNET_DISK_file_read (fh, &nh, sizeof (struct GNUNET_HashCode))))
{
- if (0 == memcmp (&nh, nsid, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&nh, nsid, sizeof (struct GNUNET_HashCode)))
{
idx = i;
break;
}
i++;
- len -= sizeof (GNUNET_HashCode);
+ len -= sizeof (struct GNUNET_HashCode);
}
if (idx == -1)
{
idx = i;
- if (sizeof (GNUNET_HashCode) !=
- GNUNET_DISK_file_write (fh, nsid, sizeof (GNUNET_HashCode)))
+ if (sizeof (struct GNUNET_HashCode) !=
+ GNUNET_DISK_file_write (fh, nsid, sizeof (struct GNUNET_HashCode)))
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn);
}
GNUNET_DISK_file_close (fh);
*/
int
GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
+ const struct GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
int32_t *ret_rank, char **ret_name, int *name_is_a_dup)
{
struct GNUNET_CONTAINER_MetaData *meta;
*/
int
GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid)
+ const char *ns_uname, struct GNUNET_HashCode * nsid)
{
size_t slen;
uint64_t len;
unsigned int idx;
char *name;
- GNUNET_HashCode nh;
+ struct GNUNET_HashCode nh;
char *fn;
struct GNUNET_DISK_FileHandle *fh;
if ((GNUNET_OK != GNUNET_DISK_file_test (fn) ||
(GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) ||
- ((idx + 1) * sizeof (GNUNET_HashCode) > len))
+ ((idx + 1) * sizeof (struct GNUNET_HashCode) > len))
{
GNUNET_free (fn);
return GNUNET_SYSERR;
GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
GNUNET_free (fn);
- GNUNET_DISK_file_seek (fh, idx * sizeof (GNUNET_HashCode),
+ GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_HashCode),
GNUNET_DISK_SEEK_SET);
- if (sizeof (GNUNET_HashCode) !=
- GNUNET_DISK_file_read (fh, nsid, sizeof (GNUNET_HashCode)))
+ if (sizeof (struct GNUNET_HashCode) !=
+ GNUNET_DISK_file_read (fh, nsid, sizeof (struct GNUNET_HashCode)))
{
GNUNET_DISK_file_close (fh);
return GNUNET_SYSERR;
{
struct ListPseudonymClosure *c = cls;
int ret;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
int32_t rating;
struct GNUNET_CONTAINER_MetaData *meta;
const char *fn;
*/
int
GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, int delta)
+ const struct GNUNET_HashCode * nsid, int delta)
{
struct GNUNET_CONTAINER_MetaData *meta;
int ret;
*/
int
GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name,
+ const struct GNUNET_HashCode * nsid, const char *name,
const struct GNUNET_CONTAINER_MetaData *md, int rank)
{
GNUNET_assert (cfg != NULL);
*/
void
GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * id,
+ const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta)
{
char *name;
* Generate a random hashcode.
*/
static void
-nextHC (GNUNET_HashCode * hc)
+nextHC (struct GNUNET_HashCode * hc)
{
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc);
}
static int
-add_iterator (void *cls, GNUNET_HashCode * next)
+add_iterator (void *cls, struct GNUNET_HashCode * next)
{
int *ret = cls;
- GNUNET_HashCode pos;
+ struct GNUNET_HashCode pos;
if (0 == (*ret)--)
return GNUNET_NO;
{
struct GNUNET_CONTAINER_BloomFilter *bf;
struct GNUNET_CONTAINER_BloomFilter *bfi;
- GNUNET_HashCode tmp;
+ struct GNUNET_HashCode tmp;
int i;
int ok1;
int ok2;
testMap (int i)
{
struct GNUNET_CONTAINER_MultiHashMap *m;
- GNUNET_HashCode k1;
- GNUNET_HashCode k2;
+ struct GNUNET_HashCode k1;
+ struct GNUNET_HashCode k2;
const char *ret;
int j;
static int
test (int number)
{
- GNUNET_HashCode h1;
- GNUNET_HashCode h2;
+ struct GNUNET_HashCode h1;
+ struct GNUNET_HashCode h2;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
- memset (&h1, number, sizeof (GNUNET_HashCode));
+ memset (&h1, number, sizeof (struct GNUNET_HashCode));
GNUNET_CRYPTO_hash_to_enc (&h1, &enc);
if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char *) &enc, &h2))
{
printf ("enc2hash failed!\n");
return 1;
}
- if (0 != memcmp (&h1, &h2, sizeof (GNUNET_HashCode)))
+ if (0 != memcmp (&h1, &h2, sizeof (struct GNUNET_HashCode)))
return 1;
return 0;
}
{
static struct GNUNET_CRYPTO_AesSessionKey zskey;
static struct GNUNET_CRYPTO_AesInitializationVector ziv;
- GNUNET_HashCode h1;
- GNUNET_HashCode h2;
- GNUNET_HashCode d;
- GNUNET_HashCode s;
+ struct GNUNET_HashCode h1;
+ struct GNUNET_HashCode h2;
+ struct GNUNET_HashCode d;
+ struct GNUNET_HashCode s;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
}
static void
-finished_task (void *cls, const GNUNET_HashCode * res)
+finished_task (void *cls, const struct GNUNET_HashCode * res)
{
int *ret = cls;
- GNUNET_HashCode want;
+ struct GNUNET_HashCode want;
GNUNET_CRYPTO_hash (block, sizeof (block), &want);
if (0 != memcmp (res, &want, sizeof (want)))
{
const char *want =
"010601000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b73c215f7a5e6b09bec55713c901786c09324a150980e014bdb0d04426934929c3b4971a9711af5455536cd6eeb8bfa004ee904972a737455f53c752987d8c82b755bc02882b44950c4acdc1672ba74c3b94d81a4c1ea3d74e7700ae5594c3a4f3c559e4bff2df6844fac302e4b66175e14dc8bad3ce44281d2fec1a1abef06301010000";
- GNUNET_HashCode in;
+ struct GNUNET_HashCode in;
struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
int i;
static int
testMultiKey (const char *word)
{
- GNUNET_HashCode in;
+ struct GNUNET_HashCode in;
struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1;
main (int argc, char *argv[])
{
int failureCount = 0;
- GNUNET_HashCode in;
+ struct GNUNET_HashCode in;
struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL);
static struct GNUNET_CONTAINER_MetaData *meta;
-static GNUNET_HashCode id1;
+static struct GNUNET_HashCode id1;
static int
-iter (void *cls, const GNUNET_HashCode * pseudonym,
+iter (void *cls, const struct GNUNET_HashCode * pseudonym,
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
int *ok = cls;
- if ((0 == memcmp (pseudonym, &id1, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (pseudonym, &id1, sizeof (struct GNUNET_HashCode))) &&
(!GNUNET_CONTAINER_meta_data_test_equal (md, meta)))
{
*ok = GNUNET_NO;
}
static int
-noti_callback (void *cls, const GNUNET_HashCode * pseudonym,
+noti_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
}
static int
-fake_noti_callback (void *cls, const GNUNET_HashCode * pseudonym,
+fake_noti_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
}
static int
-false_callback (void *cls, const GNUNET_HashCode * pseudonym,
+false_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
main (int argc, char *argv[])
{
int ok;
- GNUNET_HashCode rid1;
- GNUNET_HashCode id2;
- GNUNET_HashCode rid2;
- GNUNET_HashCode fid;
- GNUNET_HashCode id3;
+ struct GNUNET_HashCode rid1;
+ struct GNUNET_HashCode id2;
+ struct GNUNET_HashCode rid2;
+ struct GNUNET_HashCode fid;
+ struct GNUNET_HashCode id3;
int old;
int newVal;
CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, name1, &rid1));
CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name2_unique, &rid2));
CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name1_unique, &rid1));
- CHECK (0 == memcmp (&id1, &rid1, sizeof (GNUNET_HashCode)));
- CHECK (0 == memcmp (&id2, &rid2, sizeof (GNUNET_HashCode)));
+ CHECK (0 == memcmp (&id1, &rid1, sizeof (struct GNUNET_HashCode)));
+ CHECK (0 == memcmp (&id2, &rid2, sizeof (struct GNUNET_HashCode)));
GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &fid);
GNUNET_log_skip (1, GNUNET_NO);
* Key under which this entry is in the 'destination_map' (only valid
* if 'heap_node != NULL').
*/
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
/**
* Pre-allocated tunnel for this destination, or NULL for none.
/**
* The description of the service (only used for service tunnels).
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/**
* Peer offering the service.
static void
get_destination_key_from_ip (int af,
const void *address,
- GNUNET_HashCode *key)
+ struct GNUNET_HashCode *key)
{
switch (af)
{
uint16_t source_port,
const void *destination_ip,
uint16_t destination_port,
- GNUNET_HashCode *key)
+ struct GNUNET_HashCode *key)
{
char *off;
- memset (key, 0, sizeof (GNUNET_HashCode));
+ memset (key, 0, sizeof (struct GNUNET_HashCode));
/* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash,
so we put the ports in there (and hope for few collisions) */
off = (char*) key;
static void
free_tunnel_state (struct TunnelState *ts)
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelMessageQueueEntry *tnq;
struct GNUNET_MESH_Tunnel *tunnel;
const void *payload,
size_t payload_length)
{
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelState *ts;
struct TunnelMessageQueueEntry *tnq;
size_t alen;
{
const struct GNUNET_TUN_Layer2PacketHeader *tun;
size_t mlen;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct DestinationEntry *de;
GNUNET_STATISTICS_update (stats,
struct in_addr addr;
struct in_addr mask;
struct in_addr rnd;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
unsigned int tries;
GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr));
struct in6_addr mask;
struct in6_addr rnd;
int i;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
unsigned int tries;
GNUNET_assert (1 == inet_pton (AF_INET6, ipv6addr, &addr));
struct in6_addr v6;
void *addr;
struct DestinationEntry *de;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelState *ts;
/* validate and parse request */
struct in6_addr v6;
void *addr;
struct DestinationEntry *de;
- GNUNET_HashCode key;
+ struct GNUNET_HashCode key;
struct TunnelState *ts;
/* parse request */
*/
static int
cleanup_destination (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct DestinationEntry *de = value;
*/
static int
cleanup_tunnel (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct TunnelState *ts = value;
*/
static int
cleanup_tunnel_client (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct GNUNET_SERVER_Client *client = cls;
*/
static int
cleanup_destination_client (void *cls,
- const GNUNET_HashCode *key,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct GNUNET_SERVER_Client *client = cls;
int dst_af;
int req_af;
struct GNUNET_PeerIdentity peer;
- GNUNET_HashCode sd;
+ struct GNUNET_HashCode sd;
const void *addr;
struct in_addr v4;
struct in6_addr v6;
/**
* Service descriptor identifying the service.
*/
- GNUNET_HashCode service_descriptor;
+ struct GNUNET_HashCode service_descriptor;
/**
* Unique ID to match a future response to this request.
/**
* For service redirection, service descriptor.
*/
- GNUNET_HashCode serv;
+ struct GNUNET_HashCode serv;
/**
* At what time should the created service mapping expire?
int result_af,
uint8_t protocol,
const struct GNUNET_PeerIdentity *peer,
- const GNUNET_HashCode *serv,
+ const struct GNUNET_HashCode *serv,
int nac,
struct GNUNET_TIME_Absolute expiration_time,
GNUNET_VPN_AllocationCallback cb,