CADET_TUNNEL_KEY_UNINITIALIZED,
/**
- * Ephemeral key sent, waiting for peer's key.
+ * KX message sent, waiting for other peer's KX_AUTH.
*/
- CADET_TUNNEL_KEY_SENT,
+ CADET_TUNNEL_KEY_AX_SENT,
/**
- * Key received and we sent ours back, but we got no traffic yet.
+ * KX message received, trying to send back KX_AUTH.
+ */
+ CADET_TUNNEL_KEY_AX_RECV,
+
+ /**
+ * KX message sent and received, trying to send back KX_AUTH.
+ */
+ CADET_TUNNEL_KEY_AX_SENT_AND_RECV,
+
+ /**
+ * KX received and we sent KX_AUTH back, but we got no traffic yet,
+ * so we're waiting for either KX_AUTH or ENCRYPED traffic from
+ * the other peer.
+ *
* We will not yet send traffic, as this might have been a replay.
* The other (initiating) peer should send a CHANNEL_OPEN next
- * anyway.
+ * anyway, and then we are in business!
*/
- CADET_TUNNEL_KEY_PING,
+ CADET_TUNNEL_KEY_AX_AUTH_SENT,
/**
* Handshake completed: session key available.
*
* @param t a tunnel
* @param cid connection identifer to use for the connection
+ * @param options options for the connection
* @param path path to use for the connection
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on failure (duplicate connection)
int
GCT_add_inbound_connection (struct CadetTunnel *t,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetPeerPath *path);
struct GNUNET_CADET_ChannelTunnelNumber ctn);
+/**
+ * Function called when a transmission requested using #GCT_send is done.
+ *
+ * @param cls closure
+ * @param ctn identifier of the connection used for transmission, NULL if
+ * the transmission failed (to be used to match ACKs to the
+ * respective connection for connection performance evaluation)
+ */
+typedef void
+(*GCT_SendContinuation)(void *cls,
+ const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid);
+
+
/**
* Sends an already built message on a tunnel, encrypting it and
* choosing the best connection if not provided.
struct CadetTunnelQueueEntry *
GCT_send (struct CadetTunnel *t,
const struct GNUNET_MessageHeader *message,
- GNUNET_SCHEDULER_TaskCallback cont,
+ GCT_SendContinuation cont,
void *cont_cls);
* @return number of connections available for the tunnel
*/
unsigned int
-GCT_count_any_connections (struct CadetTunnel *t);
+GCT_count_any_connections (const struct CadetTunnel *t);
/**
* Iterator over connections.
*
* @param cls closure
- * @param c one of the connections
+ * @param ct one of the connections
*/
typedef void
(*GCT_ConnectionIterator) (void *cls,
- struct CadetConnection *c);
+ struct CadetTConnection *ct);
/**
const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg);
+/**
+ * Handle KX_AUTH message.
+ *
+ * @param ct connection/tunnel combo that received encrypted message
+ * @param msg the key exchange message
+ */
+void
+GCT_handle_kx_auth (struct CadetTConnection *ct,
+ const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg);
+
+
/**
* Handle encrypted message.
*