- ats, ats_count,
- bandwidth_in, bandwidth_out);
-}
-
-
-/**
- * Function called to notify transport users that another
- * peer connected to us.
- *
- * @param cls closure
- * @param peer the peer that connected
- * @param bandwidth_in inbound bandwidth in NBO
- * @param bandwidth_out outbound bandwidth in NBO
- */
-static void
-neighbours_connect_notification (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
- size_t len = sizeof(struct ConnectInfoMessage);
- char buf[len] GNUNET_ALIGN;
- struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf;
-
- connections++;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "We are now connected to peer `%s' and %u peers in total\n",
- GNUNET_i2s (peer), connections);
- connect_msg->header.size = htons (sizeof(buf));
- connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
- connect_msg->id = *peer;
- connect_msg->quota_in = bandwidth_in;
- connect_msg->quota_out = bandwidth_out;
- GST_clients_broadcast (&connect_msg->header, GNUNET_NO);
-}
-
-
-/**
- * Function called to notify transport users that another
- * peer disconnected from us.
- *
- * @param cls closure
- * @param peer the peer that disconnected
- */
-static void
-neighbours_disconnect_notification (void *cls,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct DisconnectInfoMessage disconnect_msg;
-
- connections--;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Peer `%s' disconnected and we are connected to %u peers\n",
- GNUNET_i2s (peer), connections);
-
- GST_manipulation_peer_disconnect (peer);
- disconnect_msg.header.size = htons (sizeof(struct DisconnectInfoMessage));
- disconnect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT);
- disconnect_msg.reserved = htonl (0);
- disconnect_msg.peer = *peer;
- GST_clients_broadcast (&disconnect_msg.header, GNUNET_NO);
-}
-
-
-/**
- * Function called to notify transport users that a neighbour peer changed its
- * active address.
- *
- * @param cls closure
- * @param peer peer this update is about (never NULL)
- * @param address address, NULL on disconnect
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- * @param bandwidth_in bandwidth assigned inbound
- * @param bandwidth_out bandwidth assigned outbound
- */
-static void
-neighbours_changed_notification (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
- enum GNUNET_TRANSPORT_PeerState state,
- struct GNUNET_TIME_Absolute state_timeout,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n",
- GNUNET_i2s (peer),
- (NULL != address) ? GST_plugins_a2s (address) : "<none>",
- GNUNET_TRANSPORT_ps2s (state),
- GNUNET_STRINGS_absolute_time_to_string (state_timeout));
-
- GST_clients_broadcast_peer_notification (peer,
- address,
- state,
- state_timeout);