*/
struct GNUNET_PeerIdentity peer;
- /**
- * First of the ATS information blocks (we must have at least
- * one due to the 0-termination requirement).
- */
- struct GNUNET_ATS_Information ats;
-
};
const struct GNUNET_MessageHeader *em;
const struct SendMessageReady *smr;
const struct GNUNET_CORE_MessageHandler *mh;
+ const struct GNUNET_ATS_Information* ats;
GNUNET_CORE_StartupCallback init;
struct PeerRecord *pr;
struct GNUNET_CORE_TransmitHandle *th;
&h->me.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
if (NULL != h->connects)
- h->connects (h->cls, &h->me, NULL);
+ h->connects (h->cls, &h->me, NULL, 0);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT:
if (msize < sizeof (struct ConnectNotifyMessage))
}
cnm = (const struct ConnectNotifyMessage *) msg;
ats_count = ntohl (cnm->ats_count);
- if ((msize !=
- sizeof (struct ConnectNotifyMessage) +
- ats_count * sizeof (struct GNUNET_ATS_Information)) ||
- (GNUNET_ATS_ARRAY_TERMINATOR !=
- ntohl ((&cnm->ats)[ats_count].type)))
+ if (msize !=
+ sizeof (struct ConnectNotifyMessage) +
+ ats_count * sizeof (struct GNUNET_ATS_Information))
{
GNUNET_break (0);
reconnect_later (h);
GNUNET_CONTAINER_multihashmap_put (h->peers,
&cnm->peer.hashPubKey, pr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
+ ats = (const struct GNUNET_ATS_Information*) &cnm[1];
if (NULL != h->connects)
- h->connects (h->cls, &cnm->peer, &cnm->ats);
+ h->connects (h->cls, &cnm->peer,
+ ats,
+ ats_count);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT:
if (msize != sizeof (struct DisconnectNotifyMessage))
continue;
}
if (GNUNET_OK !=
- h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats))
+ h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats,
+ ats_count))
{
/* error in processing, do not process other messages! */
break;
}
}
if (NULL != h->inbound_notify)
- h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats);
+ h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats,
+ ats_count);
break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND:
if (msize < sizeof (struct NotifyTrafficMessage))
GNUNET_break (0);
break;
}
- h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats);
+ h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats, ats_count);
break;
case GNUNET_MESSAGE_TYPE_CORE_SEND_READY:
if (msize != sizeof (struct SendMessageReady))
(ntohs (msg->size) == sizeof (struct GNUNET_MessageHeader))))
{
if (request_context->peer_cb != NULL)
- request_context->peer_cb (request_context->cb_cls, NULL, NULL);
+ request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
GNUNET_free (request_context);
return;
{
GNUNET_break (0);
if (request_context->peer_cb != NULL)
- request_context->peer_cb (request_context->cb_cls, NULL, NULL);
+ request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
GNUNET_free (request_context);
return;
}
connect_message = (const struct ConnectNotifyMessage *) msg;
ats_count = ntohl (connect_message->ats_count);
- if ((msize !=
- sizeof (struct ConnectNotifyMessage) +
- ats_count * sizeof (struct GNUNET_ATS_Information)) ||
- (GNUNET_ATS_ARRAY_TERMINATOR !=
- ntohl ((&connect_message->ats)[ats_count].type)))
+ if (msize !=
+ sizeof (struct ConnectNotifyMessage) +
+ ats_count * sizeof (struct GNUNET_ATS_Information))
{
GNUNET_break (0);
if (request_context->peer_cb != NULL)
- request_context->peer_cb (request_context->cb_cls, NULL, NULL);
+ request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
GNUNET_free (request_context);
return;
/* Normal case */
if (request_context->peer_cb != NULL)
request_context->peer_cb (request_context->cb_cls, &connect_message->peer,
- &connect_message->ats);
+ (const struct GNUNET_ATS_Information *) &connect_message[1],
+ ats_count);
GNUNET_CLIENT_receive (request_context->client, &receive_info,
request_context, GNUNET_TIME_UNIT_FOREVER_REL);
}
*/
static void
connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct PrintContext *pc;
cnm->header.size = htons (size);
cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
cnm->ats_count = htonl (atsi_count);
- a = &cnm->ats;
+ a = (struct GNUNET_ATS_Information* ) &cnm[1];
memcpy (a, atsi,
sizeof (struct GNUNET_ATS_Information) * atsi_count);
- a[atsi_count].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
- a[atsi_count].value = htonl (0);
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending `%s' message to client.\n",
struct GNUNET_SERVER_TransmitContext *tc = cls;
struct Session *session = value;
struct ConnectNotifyMessage cnm;
- struct GNUNET_ATS_Information *a;
/* FIXME: code duplication with clients... */
cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
+ // FIXME: full ats...
cnm.ats_count = htonl (0);
cnm.peer = session->peer;
- a = &cnm.ats;
- // FIXME: full ats...
- a[0].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR);
- a[0].value = htonl (0);
GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header);
return GNUNET_OK;
}
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
struct PeerContext *pc = cls;
static int
inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core provides inbound data from `%4s'.\n", GNUNET_i2s (other));
static int
outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core notifies about outbound data for `%4s'.\n",
static int
process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving message from `%4s'.\n",
GNUNET_i2s (peer));
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
struct PeerContext *pc = cls;
static int
inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static int
outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static int
process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
static int n;
unsigned int s;
static int
receive (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
if (die_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (die_task);
static void
connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %s.\n",
GNUNET_i2s (peer));
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
}
static int
inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
return GNUNET_OK;
}
static int
outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
return GNUNET_OK;
}
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
struct PeerContext *pc = cls;
static int
inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
#if DEBUG_TRANSMISSION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static int
outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
#if DEBUG_TRANSMISSION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static int
process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count)
{
static int n;
const struct TestMessage *hdr;
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct PeerInfo *ret;
int peer_bucket;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information
- *atsi)
+ *atsi,
+ unsigned int atsi_count)
{
const struct PeerPutMessage *put;
const struct GNUNET_PeerIdentity *put_path;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information
- *atsi)
+ *atsi,
+ unsigned int atsi_count)
{
struct PeerGetMessage *get;
uint32_t xquery_size;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_YES (do not cut p2p connection)
*/
static int
handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information
- *atsi)
+ *atsi,
+ unsigned int atsi_count)
{
const struct PeerResultMessage *prm;
const struct GNUNET_PeerIdentity *put_path;
* for loopback messages where we are both sender and receiver)
* @param message the actual message
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GSF_ConnectedPeer *cp;
* for loopback messages where we are both sender and receiver)
* @param message the actual message
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GSF_PendingRequest *pr;
* @param cls closure, not used
* @param peer peer identity this notification is about
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
*/
static void
peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GSF_ConnectedPeer *cp;
if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
- cp = GSF_peer_connect_handler_ (peer, atsi);
+ cp = GSF_peer_connect_handler_ (peer, atsi, atsi_count);
if (NULL == cp)
return;
GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, cp);
* Find latency information in 'atsi'.
*
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return connection latency
*/
static struct GNUNET_TIME_Relative
-get_latency (const struct GNUNET_ATS_Information *atsi)
+get_latency (const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
- if (atsi == NULL)
- return GNUNET_TIME_UNIT_SECONDS;
- while ((ntohl (atsi->type) != GNUNET_ATS_ARRAY_TERMINATOR) &&
- (ntohl (atsi->type) != GNUNET_ATS_QUALITY_NET_DELAY))
- atsi++;
- if (ntohl (atsi->type) == GNUNET_ATS_ARRAY_TERMINATOR)
- {
- /* We sometime have no latency data, i.e. if the address came from
- peerinfo and we never had a chance to play transport-level
- PING/PONG yet. Assume 1s in that case. */
- return GNUNET_TIME_UNIT_SECONDS;
- }
- return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
- ntohl (atsi->value));
+ unsigned int i;
+
+ for (i=0;i<atsi_count;i++)
+ if (ntohl (atsi->type) == GNUNET_ATS_QUALITY_NET_DELAY)
+ return GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
+ ntohl (atsi->value));
+ return GNUNET_TIME_UNIT_SECONDS;
}
*
* @param cp peer record to update
* @param atsi transport performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
update_atsi (struct GSF_ConnectedPeer *cp,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_TIME_Relative latency;
- latency = get_latency (atsi);
+ latency = get_latency (atsi, atsi_count);
GNUNET_LOAD_value_set_decline (cp->ppd.transmission_delay, latency);
/* LATER: merge atsi into cp's performance data (if we ever care...) */
}
*
* @param peer identity of peer that connected
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
* @return handle to connected peer entry
*/
struct GSF_ConnectedPeer *
GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GSF_ConnectedPeer *cp;
char *fn;
("# peers connected"),
GNUNET_CONTAINER_multihashmap_size (cp_map),
GNUNET_NO);
- update_atsi (cp, atsi);
+ update_atsi (cp, atsi, atsi_count);
GSF_push_start_ (cp);
return cp;
}
* for loopback messages where we are both sender and receiver)
* @param message the actual message
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information
- *atsi)
+ *atsi,
+ unsigned int atsi_count)
{
struct GSF_ConnectedPeer *cp;
const struct MigrationStopMessage *msm;
cp->mig_revive_task =
GNUNET_SCHEDULER_add_delayed (bt, &revive_migration, cp);
}
- update_atsi (cp, atsi);
+ update_atsi (cp, atsi, atsi_count);
return GNUNET_OK;
}
*
* @param peer identity of peer that connected
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
* @return handle to connected peer entry
*/
struct GSF_ConnectedPeer *
GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi);
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count);
/**
* for loopback messages where we are both sender and receiver)
* @param message the actual message
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information
- *atsi);
+ *atsi,
+ unsigned int atsi_count);
/**
/**
* Core handler for p2p hostlist advertisements
+ *
+ * @param atsi_count number of records in 'atsi'
*/
static int
advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
GNUNET_assert (NULL != client_adv_handler);
- return (*client_adv_handler) (cls, peer, message, atsi);
+ return (*client_adv_handler) (cls, peer, message, atsi, atsi_count);
}
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity)))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"A new peer connected, notifying client and server\n");
if (NULL != client_ch)
- (*client_ch) (cls, peer, atsi);
+ (*client_ch) (cls, peer, atsi, atsi_count);
#if HAVE_MHD
if (NULL != server_ch)
- (*server_ch) (cls, peer, atsi);
+ (*server_ch) (cls, peer, atsi, atsi_count);
#endif
}
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
GNUNET_assert (stat_connection_count < UINT_MAX);
stat_connection_count++;
* @param peer the peer sending the message
* @param message the actual message
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
size_t size;
size_t uri_size;
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
size_t size;
static int
ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
char *hostname;
char *expected_uri;
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
*/
typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls,
const struct
GNUNET_PeerIdentity * peer,
const struct
GNUNET_ATS_Information
- * atsi);
+ * atsi,
+ unsigned int atsi_count);
/**
* for loopback messages where we are both sender and receiver)
* @param message the actual message
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
message,
const struct
GNUNET_ATS_Information *
- atsi);
+ atsi,
+ unsigned int atsi_count);
/**
* @param sender who sent the message
* @param message the actual message
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
message,
const struct
GNUNET_ATS_Information *
- atsi);
+ atsi,
+ unsigned int atsi_count);
/**
* @param cls closure
* @param peer peer identity the tunnel was created to, NULL on timeout
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
*/
typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls,
const struct
GNUNET_PeerIdentity * peer,
const struct
GNUNET_ATS_Information
- * atsi);
+ * atsi,
+ unsigned int atsi_count);
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
static int
handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
unsigned int own_pos;
uint16_t size;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
static int
handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_ManipulatePath *msg;
struct GNUNET_PeerIdentity *pi;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
static int
handle_mesh_tunnel_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_TunnelDestroy *msg;
struct MeshTunnel *t;
* @param peer peer identity this notification is about
* @param message message
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_Unicast *msg;
struct MeshTunnel *t;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*
static int
handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_Multicast *msg;
struct MeshTunnel *t;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
static int
handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_ToOrigin *msg;
struct GNUNET_PeerIdentity id;
* @param message message
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
static int
handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_PathACK *msg;
struct GNUNET_PeerIdentity id;
copy->tid = htonl (t->id.tid);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: calling generic handler...\n");
- handle_mesh_data_unicast (NULL, &my_full_id, ©->header, NULL);
+ handle_mesh_data_unicast (NULL, &my_full_id, ©->header, NULL, 0);
}
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
copy->sender = my_full_id;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: calling generic handler...\n");
- handle_mesh_data_to_orig (NULL, &my_full_id, ©->header, NULL);
+ handle_mesh_data_to_orig (NULL, &my_full_id, ©->header, NULL, 0);
}
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
copy->tid = htonl(t->id.tid);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"MESH: calling generic handler...\n");
- handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL);
+ handle_mesh_data_multicast(client, &my_full_id, ©->header, NULL, 0);
}
/* receive done gets called when last copy is sent to a neighbor */
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
*/
static void
core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct MeshPeerInfo *peer_info;
struct MeshPeerPath *path;
/* list of application-types */
struct type_list_element *type_head, *type_tail;
- struct GNUNET_ATS_Information atsi;
struct peer_list_element *next, *prev;
/* The handle that sends the hellos to this peer */
struct GNUNET_MESH_Tunnel *tunnel = cls;
- tunnel->connect_handler (tunnel->handler_cls, NULL, NULL);
+ tunnel->connect_handler (tunnel->handler_cls, NULL, NULL, 0);
}
static void
struct GNUNET_MESH_Tunnel *tunnel = cls;
- tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL);
+ tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL, 0);
GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
}
struct GNUNET_MESH_Tunnel *tunnel = cls;
- tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL);
+ tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL, 0);
GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
}
*/
static void
core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_Handle *handle = cls;
/* Send a hello to this peer */
element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element);
-
- if (NULL != atsi)
- memcpy (&element->atsi, atsi,
- sizeof (struct GNUNET_ATS_Information));
-
GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head,
handle->connected_peers.tail,
handle->connected_peers.tail, element);
handle->established_tunnels.tail,
handle->established_tunnels.tail,
tunnel);
- tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi);
+ tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi, atsi_count);
GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
tunnel = next;
}
static int
receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_Handle *handle = cls;
uint16_t *num = (uint16_t *) (message + 1);
memcpy (&tunnel->tunnel.peer, other,
sizeof (struct GNUNET_PeerIdentity));
tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls,
- &tunnel->tunnel.peer, atsi);
+ &tunnel->tunnel.peer, atsi, atsi_count);
GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
break;
}
static int
core_receive (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_MESH_Handle *handle = cls;
struct tunnel_message *tmessage = (struct tunnel_message *) message;
GNUNET_i2s (other), ntohs (rmessage->type));
return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx,
- other, rmessage, atsi);
+ other, rmessage, atsi, atsi_count);
}
struct GNUNET_MESH_Tunnel *
* @param message message
* @param peer peer identity this message is from (ignored)
* @param atsi performance data (ignored)
- *
+ * @param atsi_count number of records in 'atsi'
*/
static int
handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
const struct GNUNET_NSE_FloodMessage *incoming_flood;
struct GNUNET_TIME_Absolute ts;
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct NSEPeerEntry *peer_entry;
static int
process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
char *dotOutFileNameFinished;
FILE *dotOutFileFinished;
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data for the connection
+ * @param atsi_count number of records in 'atsi'
*/
static void
connect_notify_peers (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct TestMessageContext *pos = cls;
* @param cls our "struct GNUNET_TESTING_ConnectContext"
* @param peer identity of the peer that has connected
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
*
*/
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_TESTING_ConnectContext *ctx = cls;
* @param peer identity of the peer that has connected,
* NULL when iteration has finished
* @param atsi performance information
+ * @param atsi_count number of records in 'atsi'
*
*/
static void
core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct GNUNET_TESTING_ConnectContext *ctx = cls;
*/
static void
internal_topology_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct CoreContext *core_ctx = cls;
struct TopologyIterateContext *iter_ctx = core_ctx->iter_context;
&internal_topology_callback, core_context))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Topology iteration failed.\n");
- internal_topology_callback (core_context, NULL, NULL);
+ internal_topology_callback (core_context, NULL, NULL, 0);
}
}
}
* @param cls closure
* @param peer peer identity this notification is about
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
*/
static void
connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct Peer *pos;
* for loopback messages where we are both sender and receiver)
* @param message the actual HELLO message
* @param atsi performance data
+ * @param atsi_count number of records in 'atsi'
* @return GNUNET_OK to keep the connection open,
* GNUNET_SYSERR to close it (signal serious error)
*/
static int
handle_encrypted_hello (void *cls, const struct GNUNET_PeerIdentity *other,
const struct GNUNET_MessageHeader *message,
- const struct GNUNET_ATS_Information *atsi)
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
{
struct Peer *peer;
struct GNUNET_PeerIdentity pid;
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet\n");
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1);
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1);
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1);
else if (NULL != cls)
{
*cls = me->tunnel;
- send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL);
+ send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Queued to send IPv6 to peer %x, type %d\n",
*((unsigned int *) &me->desc.peer), ntohs (hdr->type));
else if (NULL != cls)
{
*cls = me->tunnel;
- send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL);
+ send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0);
}
}
}
else if (NULL != cls)
{
*cls = me->tunnel;
- send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL);
+ send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Queued to send IPv4 to peer %x, type %d\n",
*((unsigned int *) &me->desc.peer),
else if (NULL != cls)
{
*cls = me->tunnel;
- send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL);
+ send_pkt_to_peer (cls, (struct GNUNET_PeerIdentity *) 1, NULL, 0);
}
}
}
void
send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
/* peer == NULL means that all peers in this request are connected */
if (peer == NULL)
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct remote_addr *s = (struct remote_addr *) desc;
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
GNUNET_HashCode *desc = (GNUNET_HashCode *) (message + 1);
struct remote_addr *s = (struct remote_addr *) desc;
void
send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_ATS_Information *atsi);
+ const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count);
/**
* The configuration to use
void
mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
if (NULL == peer)
return;
__attribute__ ((unused)),
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
struct dns_pkt *dns = (struct dns_pkt *) (message + 1);
const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi
- __attribute__ ((unused)))
+ __attribute__ ((unused)),
+ unsigned int atsi_count
+ __attribute__ ((unused)))
{
/* TODo: size check */
struct dns_pkt *dns = (struct dns_pkt *) (message + 1);