X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fcadet%2Fgnunet-service-cadet_tunnel.h;h=1b56a06326ad3c9b0e43fde17784b74b2d1a9b60;hb=d02945974366f76bcb63b83834175848d1cc937a;hp=c7a795129968c9a5bbb16511bff961d728f4c45a;hpb=be292dcd4d2e4f15f319d00671ce6bd6410bee38;p=oweals%2Fgnunet.git diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index c7a795129..1b56a0632 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2013 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -47,24 +47,24 @@ extern "C" */ enum CadetTunnelCState { - /** - * Uninitialized status, should never appear in operation. - */ + /** + * Uninitialized status, should never appear in operation. + */ CADET_TUNNEL_NEW, - /** - * No path to the peer known yet. - */ + /** + * No path to the peer known yet. + */ CADET_TUNNEL_SEARCHING, - /** - * Request sent, not yet answered. - */ + /** + * Request sent, not yet answered. + */ CADET_TUNNEL_WAITING, - /** - * Peer connected and ready to accept data. - */ + /** + * Peer connected and ready to accept data. + */ CADET_TUNNEL_READY, /** @@ -87,15 +87,24 @@ enum CadetTunnelEState /** * Ephemeral key sent, waiting for peer's key. */ - CADET_TUNNEL_KEY_SENT, + CADET_TUNNEL_KEY_AX_SENT, /** - * New ephemeral key and ping sent, waiting for pong. + * In OTR: New ephemeral key and ping sent, waiting for pong. + * * This means that we DO have the peer's ephemeral key, otherwise the * state would be KEY_SENT. We DO NOT have a valid session key (either no * previous key or previous key expired). + * + * + * In Axolotl: Key sent and received but no deciphered traffic yet. + * + * This means that we can send traffic (otherwise we would never complete + * the handshake), but we don't have complete confirmation. Since the first + * traffic MUST be a complete channel creation 3-way handshake, no payload + * will be sent before confirmation. */ - CADET_TUNNEL_KEY_PING, + CADET_TUNNEL_KEY_AX_AUTH_SENT, /** * Handshake completed: session key available. @@ -133,13 +142,18 @@ struct CadetTunnelQueue; * @param type Type of message sent. * @param size Size of the message. */ -typedef void (*GCT_sent) (void *cls, - struct CadetTunnel *t, - struct CadetTunnelQueue *q, - uint16_t type, size_t size); +typedef void +(*GCT_sent) (void *cls, + struct CadetTunnel *t, + struct CadetTunnelQueue *q, + uint16_t type, size_t size); + +typedef void +(*GCT_conn_iter) (void *cls, struct CadetConnection *c); -typedef void (*GCT_conn_iter) (void *cls, struct CadetConnection *c); -typedef void (*GCT_chan_iter) (void *cls, struct CadetChannel *ch); + +typedef void +(*GCT_chan_iter) (void *cls, struct CadetChannel *ch); /******************************************************************************/ @@ -272,35 +286,36 @@ GCT_remove_channel (struct CadetTunnel *t, struct CadetChannel *ch); * Search for a channel by global ID. * * @param t Tunnel containing the channel. - * @param chid Public channel number. + * @param ctn Public channel number. * * @return channel handler, NULL if doesn't exist */ struct CadetChannel * -GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid); +GCT_get_channel (struct CadetTunnel *t, struct GNUNET_CADET_ChannelTunnelNumber ctn); /** - * Decrypt and demultiplex by message type. Call appropriate handler - * for a message towards a channel of a local tunnel. + * Decrypt and process an encrypted message. + * + * Calls the appropriate handler for a message in a channel of a local tunnel. * * @param t Tunnel this message came on. * @param msg Message header. */ void GCT_handle_encrypted (struct CadetTunnel *t, - const struct GNUNET_MessageHeader *msg); + const struct GNUNET_CADET_TunnelEncryptedMessage *msg); /** - * Demultiplex an encapsulated KX message by message type. + * Handle a Key eXchange message. * * @param t Tunnel on which the message came. - * @param message KX message itself. + * @param msg KX message itself. */ void GCT_handle_kx (struct CadetTunnel *t, - const struct GNUNET_MessageHeader *message); + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); /** @@ -412,8 +427,8 @@ GCT_get_destination (struct CadetTunnel *t); * * @return ID of a channel free to use. */ -CADET_ChannelNumber -GCT_get_next_chid (struct CadetTunnel *t); +struct GNUNET_CADET_ChannelTunnelNumber +GCT_get_next_ctn (struct CadetTunnel *t); /** @@ -480,25 +495,13 @@ GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, /** - * Send an Axolotl KX message. + * Send a KX message. * * @param t Tunnel on which to send it. * @param force_reply Force the other peer to reply with a KX message. */ void -GCT_send_ax_kx (struct CadetTunnel *t, int force_reply); - - -/** - * Sends an already built and encrypted message on a tunnel, choosing the best - * connection. Useful for re-queueing messages queued on a destroyed connection. - * - * @param message Message to send. Function modifies it. - * @param t Tunnel on which this message is transmitted. - */ -void -GCT_resend_message (const struct GNUNET_MessageHeader *message, - struct CadetTunnel *t); +GCT_send_kx (struct CadetTunnel *t, int force_reply); /**