*/
double avg_priority;
+ /**
+ * Trust rating for this peer
+ */
+ uint32_t trust;
+
/**
* Number of pending queries (replies are not counted)
*/
/**
* Report on receiving a reply; update the performance record of the given peer.
*
- * @param peer responding peer (will be updated)
+ * @param cp responding peer (will be updated)
* @param request_time time at which the original query was transmitted
* @param request_priority priority of the original request
* @param initiator_client local client on responsible for query (or NULL)
* @param initiator_peer other peer responsible for query (or NULL)
*/
void
-GSF_peer_update_performance_ (struct GSF_ConnectedPeer *peer,
- GNUNET_TIME_Absolute request_time,
+GSF_peer_update_performance_ (struct GSF_ConnectedPeer *cp,
+ struct GNUNET_TIME_Absolute request_time,
uint32_t request_priority,
const struct GSF_LocalClient *initiator_client,
const struct GSF_ConnectedPeer *initiator_peer);
const struct GNUNET_TRANSPORT_ATS_Information *atsi);
+/**
+ * Handle P2P "MIGRATION_STOP" message.
+ *
+ * @param cls closure, always NULL
+ * @param other the other peer involved (sender or receiver, NULL
+ * for loopback messages where we are both sender and receiver)
+ * @param message the actual message
+ * @param atsi performance information
+ * @return GNUNET_OK to keep the connection open,
+ * GNUNET_SYSERR to close it (signal serious error)
+ */
+int
+GSF_handle_p2p_migration_stop_ (void *cls,
+ const struct GNUNET_PeerIdentity *other,
+ const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_TRANSPORT_ATS_Information *atsi);
+
+
+/**
+ * Handle P2P "QUERY" message. Only responsible for creating the
+ * request entry itself and setting up reply callback and cancellation
+ * on peer disconnect. Does NOT execute the actual request strategy
+ * (planning) or local database operations.
+ *
+ * @param other the other peer involved (sender or receiver, NULL
+ * for loopback messages where we are both sender and receiver)
+ * @param message the actual message
+ * @return pending request handle, NULL on error
+ */
+struct GSF_PendingRequest *
+GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
+ const struct GNUNET_MessageHeader *message);
+
+
+/**
+ * Return the performance data record for the given peer
+ *
+ * @param cp peer to query
+ * @return performance data record for the peer
+ */
+struct GSF_PeerPerformanceData *
+GSF_get_peer_performance_data_ (struct GSF_ConnectedPeer *cp);
+
+
+/**
+ * Ask a peer to stop migrating data to us until the given point
+ * in time.
+ *
+ * @param cp peer to ask
+ * @param block_time until when to block
+ */
+void
+GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
+ struct GNUNET_TIME_Relative block_time);
+
+
/**
* A peer disconnected from us. Tear down the connected peer
* record.
/**
- * Iterate over all connected peers.
+ * Notify core about a preference we have for the given peer
+ * (to allocate more resources towards it). The change will
+ * be communicated the next time we reserve bandwidth with
+ * core (not instantly).
*
- * @param it function to call for each peer
- * @param it_cls closure for it
+ * @param cp peer to reserve bandwidth from
+ * @param pref preference change
*/
void
-GSF_iterate_connected_peers_ (GSF_ConnectedPeerIterator it,
- void *it_cls);
+GSF_connected_peer_change_preference_ (struct GSF_ConnectedPeer *cp,
+ uint64_t pref);
-// FIXME: should we allow queueing multiple reservation requests?
-// FIXME: what about cancellation?
-// FIXME: change docu on peer disconnect handling?
/**
- * Try to reserve bandwidth (to receive data FROM the given peer).
- * This function must only be called ONCE per connected peer at a
- * time; it can be called again after the 'rc' callback was invoked.
- * If the peer disconnects, the request is (silently!) ignored (and
- * the requester is responsible to register for notification about the
- * peer disconnect if any special action needs to be taken in this
- * case).
+ * Obtain the identity of a connected peer.
*
* @param cp peer to reserve bandwidth from
- * @param size number of bytes to reserve
- * @param rc function to call upon reservation success
- * @param rc_cls closure for rc
+ * @param id identity to set (written to)
*/
void
-GSF_connected_peer_reserve_ (struct GSF_ConnectedPeer *cp,
- size_t size,
- GSF_PeerReserveCallback rc,
- void *rc_cls);
+GSF_connected_peer_get_identity_ (const struct GSF_ConnectedPeer *cp,
+ struct GNUNET_PeerIdentity *id);
+
+
+/**
+ * Iterate over all connected peers.
+ *
+ * @param it function to call for each peer
+ * @param it_cls closure for it
+ */
+void
+GSF_iterate_connected_peers_ (GSF_ConnectedPeerIterator it,
+ void *it_cls);
/**