get_msg->type = htonl (gh->type);
get_msg->key = gh->key;
get_msg->unique_id = gh->unique_id;
- memcpy (&get_msg[1],
+ GNUNET_memcpy (&get_msg[1],
&gh[1],
gh->xquery_size);
GNUNET_MQ_send (h->mq,
GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN);
msg->key = gh->key;
msg->unique_id = gh->unique_id;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&gh->seen_results[transmission_offset],
sizeof (struct GNUNET_HashCode) * delta);
GNUNET_MQ_send (h->mq,
uint16_t msize = ntohs (msg->header.size) - sizeof (*msg);
if ( (plen > UINT16_MAX) ||
- (plen * sizeof (struct GNUNET_HashCode) != msize) )
+ (plen * sizeof (struct GNUNET_PeerIdentity) != msize) )
{
GNUNET_break (0);
return GNUNET_SYSERR;
meta_length =
sizeof (struct GNUNET_PeerIdentity) * (get_path_length + put_path_length);
data_length = msize - meta_length;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Giving %u byte reply for %s to application\n",
- (unsigned int) data_length,
- GNUNET_h2s (key));
put_path = (const struct GNUNET_PeerIdentity *) &crm[1];
get_path = &put_path[put_path_length];
+ {
+ char *pp;
+ char *gp;
+
+ gp = GNUNET_STRINGS_pp2s (get_path,
+ get_path_length);
+ pp = GNUNET_STRINGS_pp2s (put_path,
+ put_path_length);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Giving %u byte reply for %s to application (GP: %s, PP: %s)\n",
+ (unsigned int) data_length,
+ GNUNET_h2s (key),
+ gp,
+ pp);
+ GNUNET_free (gp);
+ GNUNET_free (pp);
+ }
data = &get_path[get_path_length];
/* remember that we've seen this result */
GNUNET_CRYPTO_hash (data,
static int
try_connect (struct GNUNET_DHT_Handle *h)
{
- GNUNET_MQ_hd_var_size (monitor_get,
- GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET,
- struct GNUNET_DHT_MonitorGetMessage);
- GNUNET_MQ_hd_var_size (monitor_get_resp,
- GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP,
- struct GNUNET_DHT_MonitorGetRespMessage);
- GNUNET_MQ_hd_var_size (monitor_put,
- GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT,
- struct GNUNET_DHT_MonitorPutMessage);
- GNUNET_MQ_hd_var_size (client_result,
- GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT,
- struct GNUNET_DHT_ClientResultMessage);
- GNUNET_MQ_hd_fixed_size (put_confirmation,
- GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK,
- struct GNUNET_DHT_ClientPutConfirmationMessage);
struct GNUNET_MQ_MessageHandler handlers[] = {
- make_monitor_get_handler (h),
- make_monitor_get_resp_handler (h),
- make_monitor_put_handler (h),
- make_client_result_handler (h),
- make_put_confirmation_handler (h),
+ GNUNET_MQ_hd_var_size (monitor_get,
+ GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET,
+ struct GNUNET_DHT_MonitorGetMessage,
+ h),
+ GNUNET_MQ_hd_var_size (monitor_get_resp,
+ GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP,
+ struct GNUNET_DHT_MonitorGetRespMessage,
+ h),
+ GNUNET_MQ_hd_var_size (monitor_put,
+ GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT,
+ struct GNUNET_DHT_MonitorPutMessage,
+ h),
+ GNUNET_MQ_hd_var_size (client_result,
+ GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT,
+ struct GNUNET_DHT_ClientResultMessage,
+ h),
+ GNUNET_MQ_hd_fixed_size (put_confirmation,
+ GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK,
+ struct GNUNET_DHT_ClientPutConfirmationMessage,
+ h),
GNUNET_MQ_handler_end ()
};
if (NULL != h->mq)
return GNUNET_OK;
- h->mq = GNUNET_CLIENT_connecT (h->cfg,
+ h->mq = GNUNET_CLIENT_connect (h->cfg,
"dht",
handlers,
&mq_error_handler,
}
if (NULL == handle->mq)
return NULL;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending PUT for %s to DHT via %p\n",
+ GNUNET_h2s (key),
+ handle);
ph = GNUNET_new (struct GNUNET_DHT_PutHandle);
ph->dht_handle = handle;
ph->cont = cont;
put_msg->unique_id = ph->unique_id;
put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
put_msg->key = *key;
- memcpy (&put_msg[1],
+ GNUNET_memcpy (&put_msg[1],
data,
size);
GNUNET_MQ_send (handle->mq,
gh->desired_replication_level = desired_replication_level;
gh->type = type;
gh->options = options;
- memcpy (&gh[1],
+ GNUNET_memcpy (&gh[1],
xquery,
xquery_size);
GNUNET_CONTAINER_multihashmap_put (handle->active_requests,
GNUNET_array_grow (get_handle->seen_results,
get_handle->seen_results_size,
needed);
- memcpy (&get_handle->seen_results[get_handle->seen_results_end],
+ GNUNET_memcpy (&get_handle->seen_results[get_handle->seen_results_end],
results,
num_results * sizeof (struct GNUNET_HashCode));
get_handle->seen_results_end += num_results;