/**
* Possible state of a neighbour. Initially, we are #GNUNET_TRANSPORT_PS_NOT_CONNECTED.
*
- * Then, there are two main paths. If we receive a CONNECT message, we
- * first run a check against the blacklist (#GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST_INBOUND).
- * If this check is successful, we give the inbound address to ATS.
- * After the check we ask ATS for a suggestion (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS).
- * If ATS makes a suggestion, we ALSO give that suggestion to the blacklist
- * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST). Once the blacklist approves the
- * address we got from ATS, we send our CONNECT_ACK and go to
- * #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK. If we receive a SESSION_ACK, we go to
- * #GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection).
- * If the operation times out, we go to #GNUNET_TRANSPORT_PS_DISCONNECT.
+ * Then, there are two main paths. If we receive a CONNECT message, we give
+ * the inbound address to ATS. After the check we ask ATS for a suggestion
+ * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). If ATS makes a suggestion, we
+ * send our CONNECT_ACK and go to #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK.
+ * If we receive a SESSION_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
+ * (and notify everyone about the new connection). If the operation times out,
+ * we go to #GNUNET_TRANSPORT_PS_DISCONNECT.
*
* The other case is where we transmit a CONNECT message first. We
- * start with #GNUNET_TRANSPORT_PS_INIT_ATS. If we get an address, we enter
- * #GNUNET_TRANSPORT_PS_INIT_BLACKLIST and check the blacklist. If the blacklist is OK
- * with the connection, we actually send the CONNECT message and go to
- * state #GNUNET_TRANSPORT_PS_CONNECT_SENT. Once we receive a CONNECT_ACK, we go to
- * #GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection and send
+ * start with #GNUNET_TRANSPORT_PS_INIT_ATS. If we get an address, we send
+ * the CONNECT message and go to state #GNUNET_TRANSPORT_PS_CONNECT_SENT.
+ * Once we receive a CONNECT_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
+ * (and notify everyone about the new connection and send
* back a SESSION_ACK). If the operation times out, we go to
* #GNUNET_TRANSPORT_PS_DISCONNECT.
*
* If the session is in trouble (i.e. transport-level disconnect or
* timeout), we go to #GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a new
* address (we don't notify anyone about the disconnect yet). Once we
- * have a new address, we go to #GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST to check the new
- * address against the blacklist. If the blacklist approves, we enter
- * #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a CONNECT message. If we receive a
+ * have a new address, we enter #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a
+ * CONNECT message. If we receive a
* CONNECT_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED and nobody noticed that we had
* trouble; we also send a SESSION_ACK at this time just in case. If
* the operation times out, we go to #GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone
* about the lost connection).
*
* If ATS decides to switch addresses while we have a normal
- * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST to check the
- * new address against the blacklist. If the blacklist approves, we
- * go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT and send a
- * SESSION_CONNECT. If we get a SESSION_ACK back, we switch the
+ * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT
+ * and send a SESSION_CONNECT. If we get a SESSION_ACK back, we switch the
* primary connection to the suggested alternative from ATS, go back
* to #GNUNET_TRANSPORT_PS_CONNECTED and send a SESSION_ACK to the other peer just to be
- * sure. If the operation times out (or the blacklist disapproves),
+ * sure. If the operation times out
* we go to #GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given alternative
* address is "invalid").
*
*/
GNUNET_TRANSPORT_PS_INIT_ATS,
- /**
- * Asked to initiate connection, trying to get address approved
- * by blacklist.
- */
- GNUNET_TRANSPORT_PS_INIT_BLACKLIST,
-
/**
* Sent CONNECT message to other peer, waiting for CONNECT_ACK
*/
GNUNET_TRANSPORT_PS_CONNECT_SENT,
- /**
- * Received a CONNECT, do a blacklist check for inbound address
- */
- GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST_INBOUND,
-
/**
* Received a CONNECT, asking ATS about address suggestions.
*/
GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS,
/**
- * Received CONNECT from other peer, got an address, checking with blacklist.
- */
- GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST,
-
- /**
- * CONNECT request from other peer was SESSION_ACK'ed, waiting for
+ * CONNECT request from other peer was CONNECT_ACK'ed, waiting for
* SESSION_ACK.
*/
GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK,
*/
GNUNET_TRANSPORT_PS_RECONNECT_ATS,
- /**
- * Connection got into trouble, rest of the system still believes
- * it to be up; we are checking the new address against the blacklist.
- */
- GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST,
-
/**
* Sent CONNECT over new address (either by ATS telling us to switch
* addresses or from RECONNECT_ATS); if this fails, we need to tell
*/
GNUNET_TRANSPORT_PS_RECONNECT_SENT,
- /**
- * We have some primary connection, but ATS suggested we switch
- * to some alternative; we're now checking the alternative against
- * the blacklist.
- */
- GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST,
-
/**
* We have some primary connection, but ATS suggested we switch
* to some alternative; we now sent a CONNECT message for the
/**
- * Current state of a validation process
+ * Current state of a validation process.
+ *
+ * FIXME: what state is used to indicate that a validation
+ * was successful? If that is clarified/determined, "UGH" in
+ * ~gnunet-peerinfo-gtk.c:1103 should be resolved.
*/
enum GNUNET_TRANSPORT_ValidationState
{
* NULL if this is the final last callback for a iteration operation
* @param address address,
* NULL for disconnect notification in monitor mode
+ * @param last_validation when was this address last validated
* @param valid_until when does this address expire
* @param next_validation time of the next validation operation
- *
+ * @param state state in the validation state machine
*/
typedef void
(*GNUNET_TRANSPORT_ValidationIterateCallback) (void *cls,
GNUNET_TRANSPORT_NotifyDisconnect nd);
+/**
+ * Function called if we have "excess" bandwidth to a peer.
+ * The notification will happen the first time we have excess
+ * bandwidth, and then only again after the client has performed
+ * some transmission to the peer.
+ *
+ * Excess bandwidth is defined as being allowed (by ATS) to send
+ * more data, and us reaching the limit of the capacity build-up
+ * (which, if we go past it, means we don't use available bandwidth).
+ * See also the "max carry" in `struct GNUNET_BANDWIDTH_Tracker`.
+ *
+ * @param cls the closure
+ * @param peer peer that we have excess bandwidth to
+ */
+typedef void
+(*GNUNET_TRANSPORT_NotifyExcessBandwidth)(void *cls,
+ const struct GNUNET_PeerIdentity *neighbour);
+
+
+/**
+ * Connect to the transport service. Note that the connection may
+ * complete (or fail) asynchronously.
+ *
+ * @param cfg configuration to use
+ * @param self our own identity (API should check that it matches
+ * the identity found by transport), or NULL (no check)
+ * @param cls closure for the callbacks
+ * @param rec receive function to call, or NULL
+ * @param nc function to call on connect events, or NULL
+ * @param nd function to call on disconnect events, or NULL
+ * @param neb function to call if we have excess bandwidth to a peer
+ * @return NULL on error
+ */
+struct GNUNET_TRANSPORT_Handle *
+GNUNET_TRANSPORT_connect2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity *self,
+ void *cls,
+ GNUNET_TRANSPORT_ReceiveCallback rec,
+ GNUNET_TRANSPORT_NotifyConnect nc,
+ GNUNET_TRANSPORT_NotifyDisconnect nd,
+ GNUNET_TRANSPORT_NotifyExcessBandwidth neb);
+
+
/**
* Disconnect from the transport service.
*
* Cancel the request to transport to try a connect
* Callback will not be called
*
- * @param tch GNUNET_TRANSPORT_TryConnectHandle handle to cancel
+ * @param tch handle to cancel
*/
void
GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch);
+/**
+ * Ask the transport service to establish a disconnect from
+ * the given peer.
+ *
+ * @param handle connection to transport service
+ * @param target who we should try to disconnect from
+ * @param cb callback to be called when request was transmitted to transport
+ * service
+ * @param cb_cls closure for the callback @a cb
+ * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or
+ * NULL on failure (@a cb will not be called)
+ */
+struct GNUNET_TRANSPORT_TryConnectHandle *
+GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle,
+ const struct GNUNET_PeerIdentity *target,
+ GNUNET_TRANSPORT_TryConnectCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel the request to transport to try a disconnect
+ * Callback will not be called
+ *
+ * @param tch handle for operation to cancel
+ */
+void
+GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch);
+
+
/**
* Opaque handle for a transmission-ready request.
*/
GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh);
+/**
+ * Handle for a #GNUNET_TRANSPORT_offer_hello operation
+ */
+struct GNUNET_TRANSPORT_OfferHelloHandle;
+
/**
* Offer the transport service the HELLO of another peer. Note that
* the transport service may just ignore this message if the HELLO is
GNUNET_TRANSPORT_vs2s (enum GNUNET_TRANSPORT_ValidationState state);
+/**
+ * Handle for a #GNUNET_TRANSPORT_monitor_peers operation.
+ */
+struct GNUNET_TRANSPORT_PeerMonitoringContext;
+
/**
* Return information about a specific peer or all peers currently known to
* transport service once or in monitoring mode. To obtain information about
GNUNET_TRANSPORT_monitor_peers_cancel (struct GNUNET_TRANSPORT_PeerMonitoringContext *pic);
+/**
+ * Handle for a #GNUNET_TRANSPORT_monitor_validation_entries() operation.
+ */
+struct GNUNET_TRANSPORT_ValidationMonitoringContext;
+
/**
* Return information about pending address validation operations for a specific
* or all peers