*/
GNUNET_CORE_DisconnectEventHandler disconnects;
- /**
- * Function to call whenever we're notified about a peer changing status.
- */
- GNUNET_CORE_PeerStatusEventHandler status_events;
-
/**
* Function to call whenever we receive an inbound message.
*/
const struct DisconnectNotifyMessage *dnm;
const struct NotifyTrafficMessage *ntm;
const struct GNUNET_MessageHeader *em;
- const struct PeerStatusNotifyMessage *psnm;
const struct SendMessageReady *smr;
const struct GNUNET_CORE_MessageHandler *mh;
GNUNET_CORE_StartupCallback init;
if (trigger)
trigger_next_request (h, GNUNET_NO);
break;
- case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_STATUS_CHANGE:
- if (NULL == h->status_events)
- {
- GNUNET_break (0);
- return;
- }
- if (msize < sizeof (struct PeerStatusNotifyMessage))
- {
- GNUNET_break (0);
- reconnect_later (h);
- return;
- }
- psnm = (const struct PeerStatusNotifyMessage *) msg;
- if (0 == memcmp (&h->me, &psnm->peer, sizeof (struct GNUNET_PeerIdentity)))
- {
- /* self-change!? */
- GNUNET_break (0);
- return;
- }
- ats_count = ntohl (psnm->ats_count);
- if ((msize !=
- sizeof (struct PeerStatusNotifyMessage) +
- ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)) ||
- (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR !=
- ntohl ((&psnm->ats)[ats_count].type)))
- {
- GNUNET_break (0);
- reconnect_later (h);
- return;
- }
-#if DEBUG_CORE > 1
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received notification about status change by `%s'.\n",
- GNUNET_i2s (&psnm->peer));
-#endif
- pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &psnm->peer.hashPubKey);
- if (pr == NULL)
- {
- GNUNET_break (0);
- reconnect_later (h);
- return;
- }
- h->status_events (h->cls, &psnm->peer, psnm->bandwidth_in,
- psnm->bandwidth_out,
- GNUNET_TIME_absolute_ntoh (psnm->timeout), &psnm->ats);
- break;
case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND:
if (msize < sizeof (struct NotifyTrafficMessage))
{
init->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT);
init->header.size = htons (msize);
opt = GNUNET_CORE_OPTION_SEND_CONNECT | GNUNET_CORE_OPTION_SEND_DISCONNECT;
- if (h->status_events != NULL)
- opt |= GNUNET_CORE_OPTION_SEND_STATUS_CHANGE;
if (h->inbound_notify != NULL)
{
if (h->inbound_hdr_only)
* connected to the core service; note that timeout is only meaningful if init is not NULL
* @param connects function to call on peer connect, can be NULL
* @param disconnects function to call on peer disconnect / timeout, can be NULL
- * @param status_events function to call on changes to peer connection status, can be NULL
* @param inbound_notify function to call for all inbound messages, can be NULL
* @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only read the
* GNUNET_MessageHeader and hence we do not need to give it the full message;
GNUNET_CORE_StartupCallback init,
GNUNET_CORE_ConnectEventHandler connects,
GNUNET_CORE_DisconnectEventHandler disconnects,
- GNUNET_CORE_PeerStatusEventHandler status_events,
GNUNET_CORE_MessageCallback inbound_notify,
int inbound_hdr_only,
GNUNET_CORE_MessageCallback outbound_notify,
h->init = init;
h->connects = connects;
h->disconnects = disconnects;
- h->status_events = status_events;
h->inbound_notify = inbound_notify;
h->outbound_notify = outbound_notify;
h->inbound_hdr_only = inbound_hdr_only;
/* connect p2 */
p2.ch =
GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify,
+ &disconnect_notify, &inbound_notify,
GNUNET_YES, &outbound_notify, GNUNET_YES,
handlers);
}
&terminate_task_error, NULL);
p1.ch =
GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify,
+ &disconnect_notify, &inbound_notify,
GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
}
OKPP;
/* connect p2 */
GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+ &disconnect_notify, &inbound_notify, GNUNET_YES,
&outbound_notify, GNUNET_YES, handlers);
}
else
err_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+ &disconnect_notify, &inbound_notify, GNUNET_YES,
&outbound_notify, GNUNET_YES, handlers);
}
"test_core_api_peer1.conf"));
core =
- GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL, NULL,
+ GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL,
NULL, 0, NULL, 0, handlers);
die_task =
/* connect p2 */
p2.ch =
GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify,
+ &disconnect_notify, &inbound_notify,
GNUNET_YES, &outbound_notify, GNUNET_YES,
handlers);
}
&timeout_task, NULL);
p1.ch =
GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify,
+ &disconnect_notify, &inbound_notify,
GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
}
OKPP;
/* connect p2 */
p2.ch = GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+ &disconnect_notify, &inbound_notify, GNUNET_YES,
&outbound_notify, GNUNET_YES, handlers);
}
else
¤t_quota_p2_out));
p1.ch = GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
- &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+ &disconnect_notify, &inbound_notify, GNUNET_YES,
&outbound_notify, GNUNET_YES, handlers);
}
&core_init,
&handle_core_connect,
&handle_core_disconnect,
- NULL, /* Do we care about "status" updates? */
NULL, GNUNET_NO,
NULL, GNUNET_NO,
core_handlers);
NULL, &peer_init_handler,
&peer_connect_handler,
&GSF_peer_disconnect_handler_,
- &GSF_peer_status_handler_, NULL, GNUNET_NO,
+ NULL, GNUNET_NO,
NULL, GNUNET_NO, p2p_handlers);
if (NULL == GSF_core)
{
}
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param timeout absolute time when this peer will time out
- * unless we see some further activity from it
- * @param atsi status information
- */
-void
-GSF_peer_status_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_TIME_Absolute timeout,
- const struct GNUNET_TRANSPORT_ATS_Information *atsi)
-{
- struct GSF_ConnectedPeer *cp;
-
- cp = GNUNET_CONTAINER_multihashmap_get (cp_map, &peer->hashPubKey);
- GNUNET_assert (NULL != cp);
- update_atsi (cp, atsi);
-}
-
-
/**
* A peer disconnected from us. Tear down the connected peer
* record.
*initiator_peer);
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param timeout absolute time when this peer will time out
- * unless we see some further activity from it
- * @param atsi status information
- */
-void
-GSF_peer_status_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_TIME_Absolute timeout,
- const struct GNUNET_TRANSPORT_ATS_Information *atsi);
-
-
/**
* Handle P2P "MIGRATION_STOP" message.
*
core =
GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_handler,
- &disconnect_handler, NULL, NULL, GNUNET_NO, NULL,
+ &disconnect_handler, NULL, GNUNET_NO, NULL,
GNUNET_NO,
learning ? learn_handlers : no_learn_handlers);
* @param preference increase incoming traffic share preference by this amount;
* in the absence of "amount" reservations, we use this
* preference value to assign proportional bandwidth shares
- * to all connected peers
+ * to all connected peers; in the future, this should be
+ * replaced with more specific QoS expressions...
* @param info function to call with the resulting configuration information
* @param info_cls closure for info
* @return NULL on error
* atsi);
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param timeout absolute time when this peer will time out
- * unless we see some further activity from it
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param atsi performance data for the connection
- */
-typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls,
- const struct
- GNUNET_PeerIdentity * peer,
- struct
- GNUNET_BANDWIDTH_Value32NBO
- bandwidth_in,
- struct
- GNUNET_BANDWIDTH_Value32NBO
- bandwidth_out,
- struct GNUNET_TIME_Absolute
- timeout,
- const struct
- GNUNET_TRANSPORT_ATS_Information
- * atsi);
-
-
/**
* Method called whenever a peer disconnects.
*
* connected to the core service; note that timeout is only meaningful if init is not NULL
* @param connects function to call on peer connect, can be NULL
* @param disconnects function to call on peer disconnect / timeout, can be NULL
- * @param status_events function to call on peer status changes, can be NULL
* @param inbound_notify function to call for all inbound messages, can be NULL
* note that the core is allowed to drop notifications about inbound
* messages if the client does not process them fast enough (for this
GNUNET_CORE_StartupCallback init,
GNUNET_CORE_ConnectEventHandler connects,
GNUNET_CORE_DisconnectEventHandler disconnects,
- GNUNET_CORE_PeerStatusEventHandler status_events,
GNUNET_CORE_MessageCallback inbound_notify,
int inbound_hdr_only,
GNUNET_CORE_MessageCallback outbound_notify,
*/
#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND 71
-/**
- * Response from server about (possibly updated) P2P
- * connection configuration.
- */
-#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 73
-
/**
* Request from client to transmit message.
*/
&core_init, /* Call core_init once connected */
&core_connect, /* Handle connects */
&core_disconnect, /* remove peers on disconnects */
- NULL, /* Do we care about "status" updates? */
NULL, /* Don't notify about all incoming messages */
GNUNET_NO, /* For header only in notification */
NULL, /* Don't notify about all outbound messages */
ret->core =
GNUNET_CORE_connect (cfg, 42, ret, &core_startup, &core_connect,
- &core_disconnect, NULL, NULL, GNUNET_NO, NULL,
+ &core_disconnect, NULL, GNUNET_NO, NULL,
GNUNET_NO, core_handlers);
ret->transport =
GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
&core_init, /* Call core_init once connected */
&handle_core_connect, /* Handle connects */
&handle_core_disconnect, /* Handle disconnects */
- NULL, /* Do we care about "status" updates? */
NULL, /* Don't want notified about all incoming messages */
GNUNET_NO, /* For header only inbound notification */
NULL, /* Don't want notified about all outbound messages */
ctx->d1core_ready = GNUNET_NO;
ctx->d1core =
GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify,
- &connect_notify, NULL, NULL, NULL, GNUNET_NO, NULL,
+ &connect_notify, NULL, NULL, GNUNET_NO, NULL,
GNUNET_NO, no_handlers);
if (ctx->d1core == NULL)
{
#endif
ctx->d1core =
GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify,
- &connect_notify, NULL, NULL, NULL, GNUNET_NO, NULL,
+ &connect_notify, NULL, NULL, GNUNET_NO, NULL,
GNUNET_NO, no_handlers);
}
transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
handle =
GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_notify,
- &disconnect_notify, NULL, NULL, GNUNET_NO, NULL,
+ &disconnect_notify, NULL, GNUNET_NO, NULL,
GNUNET_NO, handlers);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task,
NULL);