From e02d76e46cd00724d32f81375e8981524ee6f3e2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 18 Jan 2017 14:49:17 +0100 Subject: more rename festivities --- src/cadet/cadet.h | 4 +- src/cadet/cadet_api.c | 14 +-- src/cadet/cadet_common.c | 16 +-- src/cadet/cadet_protocol.h | 136 ++++++++++++++---------- src/cadet/gnunet-service-cadet-new.c | 10 +- src/cadet/gnunet-service-cadet-new_channel.c | 24 ++--- src/cadet/gnunet-service-cadet-new_connection.c | 2 +- src/cadet/gnunet-service-cadet-new_connection.h | 2 +- src/cadet/gnunet-service-cadet-new_core.c | 62 +++++------ src/cadet/gnunet-service-cadet-new_tunnels.c | 48 ++++----- src/cadet/gnunet-service-cadet-new_tunnels.h | 2 +- src/cadet/gnunet-service-cadet_channel.c | 106 +++++++++--------- src/cadet/gnunet-service-cadet_channel.h | 6 +- src/cadet/gnunet-service-cadet_connection.c | 24 ++--- src/cadet/gnunet-service-cadet_connection.h | 2 +- src/cadet/gnunet-service-cadet_local.c | 18 ++-- src/cadet/gnunet-service-cadet_local.h | 2 +- src/cadet/gnunet-service-cadet_peer.c | 26 ++--- src/cadet/gnunet-service-cadet_tunnel.c | 60 +++++------ src/cadet/gnunet-service-cadet_tunnel.h | 2 +- src/include/gnunet_constants.h | 4 +- src/include/gnunet_protocols.h | 28 ++--- src/include/gnunet_signatures.h | 5 - 23 files changed, 310 insertions(+), 293 deletions(-) diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 8218fd1ed..c16fb2917 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h @@ -135,12 +135,12 @@ struct GNUNET_CADET_PortMessage /** * Message for a client to create channels. */ -struct GNUNET_CADET_ChannelCreateMessageMessage +struct GNUNET_CADET_ChannelOpenMessageMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE * - * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessageMessage) + * Size: sizeof(struct GNUNET_CADET_ChannelOpenMessageMessage) */ struct GNUNET_MessageHeader header; diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 281d8c5f3..4a662487c 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -588,7 +588,7 @@ request_data (void *cls) */ static void handle_channel_created (void *cls, - const struct GNUNET_CADET_ChannelCreateMessageMessage *msg) + const struct GNUNET_CADET_ChannelOpenMessageMessage *msg) { struct GNUNET_CADET_Handle *h = cls; struct GNUNET_CADET_Channel *ch; @@ -1281,8 +1281,8 @@ do_reconnect (struct GNUNET_CADET_Handle *h) { struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_fixed_size (channel_created, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - struct GNUNET_CADET_ChannelCreateMessageMessage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, + struct GNUNET_CADET_ChannelOpenMessageMessage, h), GNUNET_MQ_hd_fixed_size (channel_destroy, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, @@ -1314,7 +1314,7 @@ do_reconnect (struct GNUNET_CADET_Handle *h) h), // FIXME // GNUNET_MQ_hd_fixed_Y size (channel_destroyed, -// GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED, +// GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED, // struct GNUNET_CADET_ChannelDestroyMessage); GNUNET_MQ_handler_end () }; @@ -1453,7 +1453,7 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) msg = (struct GNUNET_MessageHeader *) &th[1]; switch (ntohs(msg->type)) { - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN: case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE: @@ -1575,7 +1575,7 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { - struct GNUNET_CADET_ChannelCreateMessageMessage *msg; + struct GNUNET_CADET_ChannelOpenMessageMessage *msg; struct GNUNET_MQ_Envelope *env; struct GNUNET_CADET_Channel *ch; struct GNUNET_CADET_ClientChannelNumber chid; @@ -1591,7 +1591,7 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, ch->ctx = channel_ctx; ch->peer = GNUNET_PEER_intern (peer); - env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); + env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); msg->channel_id = ch->chid; msg->port = *port; msg->peer = *peer; diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c index 0606aac50..95a3144e4 100644 --- a/src/cadet/cadet_common.c +++ b/src/cadet/cadet_common.c @@ -167,14 +167,14 @@ GC_m2s (uint16_t m) /** * Transport payload data. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: s = "DATA"; break; /** * Confirm receipt of payload data. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: s = "DATA_ACK"; break; @@ -188,7 +188,7 @@ GC_m2s (uint16_t m) /** * Encrypted. */ - case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: s = "ENCRYPTED"; break; @@ -202,14 +202,14 @@ GC_m2s (uint16_t m) /** * ACK for a data packet. */ - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: s = "ACK"; break; /** * POLL for ACK. */ - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: s = "POLL"; break; @@ -237,7 +237,7 @@ GC_m2s (uint16_t m) /** * Ask the cadet service to create a new tunnel */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: s = "CHAN_CREAT"; break; @@ -251,14 +251,14 @@ GC_m2s (uint16_t m) /** * Confirm the creation of a channel. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: s = "CHAN_ACK"; break; /** * Confirm the creation of a channel. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: s = "CHAN_NACK"; break; diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 6a6099e97..7e4a6ae16 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h @@ -161,11 +161,15 @@ struct GNUNET_CADET_ConnectionDestroyMessage }; +/******************************************************************************/ +/******************************* TUNNEL ***********************************/ +/******************************************************************************/ + /** * Unique identifier (counter) for an encrypted message in a channel. - * Used to match #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK - * and #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL messages - * against the respective #GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED + * Used to match #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK + * and #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL messages + * against the respective #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED * messages. */ struct CadetEncryptedMessageIdentifier @@ -178,56 +182,6 @@ struct CadetEncryptedMessageIdentifier }; -/** - * Message to acknowledge cadet encrypted traffic. - */ -struct GNUNET_CADET_ConnectionEncryptedAckMessage -{ - /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK - */ - struct GNUNET_MessageHeader header; - - /** - * Maximum packet ID authorized. - */ - struct CadetEncryptedMessageIdentifier cemi; - - /** - * ID of the connection. - */ - struct GNUNET_CADET_ConnectionTunnelIdentifier cid; -}; - - -/** - * Message to query a peer about its Flow Control status regarding a tunnel. - */ -struct GNUNET_CADET_ConnectionHopByHopPollMessage -{ - /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL - */ - struct GNUNET_MessageHeader header; - - /** - * Last packet sent. - */ - struct CadetEncryptedMessageIdentifier cemi; - - /** - * ID of the connection. - */ - struct GNUNET_CADET_ConnectionTunnelIdentifier cid; - -}; - - - -/******************************************************************************/ -/******************************* TUNNEL ***********************************/ -/******************************************************************************/ - /** * Flags to be used in GNUNET_CADET_KX. */ @@ -279,16 +233,23 @@ struct GNUNET_CADET_TunnelKeyExchangeMessage * using 'gcry_sexp_sprint'. */ struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key; + +#ifdef NEW_CADET + /** + * Proof that sender could compute the 3-DH, in lieu of a signature. + */ + struct GNUNET_HashCode triple_dh_proof; +#endif }; /** * Axolotl tunnel message. */ -struct GNUNET_CADET_ConnectionEncryptedMessage +struct GNUNET_CADET_TunnelEncryptedMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED + * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED */ struct GNUNET_MessageHeader header; @@ -334,6 +295,56 @@ struct GNUNET_CADET_ConnectionEncryptedMessage }; +/** + * Message to query a peer about its Flow Control status regarding a tunnel. + * + * It is NOT yet clear if we need this. + */ +struct GNUNET_CADET_ConnectionHopByHopPollMessage +{ + /** + * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL + */ + struct GNUNET_MessageHeader header; + + /** + * Last packet sent. + */ + struct CadetEncryptedMessageIdentifier cemi; + + /** + * ID of the connection. + */ + struct GNUNET_CADET_ConnectionTunnelIdentifier cid; + +}; + + +/** + * Message to acknowledge cadet encrypted traffic, used for + * flow-control on a hop-by-hop basis on the connection-level. Note + * that we do use the @e cemi from the tunnel layer as the connection + * layer's header is included/shared with the tunnel layer messages, + * and we only do flow control for the payload. + */ +struct GNUNET_CADET_ConnectionEncryptedAckMessage +{ + /** + * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK + */ + struct GNUNET_MessageHeader header; + + /** + * Maximum packet ID authorized. + */ + struct CadetEncryptedMessageIdentifier cemi; + + /** + * ID of the connection. + */ + struct GNUNET_CADET_ConnectionTunnelIdentifier cid; +}; + /******************************************************************************/ /******************************* CHANNEL ***********************************/ @@ -344,10 +355,10 @@ struct GNUNET_CADET_ConnectionEncryptedMessage /** * Message to create a Channel. */ -struct GNUNET_CADET_ChannelCreateMessage +struct GNUNET_CADET_ChannelOpenMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE + * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN */ struct GNUNET_MessageHeader header; @@ -379,6 +390,13 @@ struct GNUNET_CADET_ChannelManageMessage */ struct GNUNET_MessageHeader header; +#ifdef NEW_CADET + /** + * For alignment. + */ + uint32_t reserved GNUNET_PACKED; +#endif + /** * ID of the channel */ @@ -391,7 +409,7 @@ struct GNUNET_CADET_ChannelManageMessage /** * Message for cadet data traffic. */ -struct GNUNET_CADET_ChannelDataMessage +struct GNUNET_CADET_ChannelAppDataMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, @@ -422,7 +440,7 @@ struct GNUNET_CADET_ChannelDataMessage struct GNUNET_CADET_ChannelDataAckMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK + * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK */ struct GNUNET_MessageHeader header; diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index 64bb25403..3e149e9bb 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c @@ -272,7 +272,7 @@ GSC_bind (struct CadetClient *c, uint32_t options) { struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_ChannelCreateMessageMessage *msg; + struct GNUNET_CADET_ChannelOpenMessageMessage *msg; struct GNUNET_CADET_ClientChannelNumber lid; lid = client_get_next_lid (c); @@ -284,7 +284,7 @@ GSC_bind (struct CadetClient *c, /* notify local client about incoming connection! */ env = GNUNET_MQ_msg (msg, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); msg->channel_id = lid; msg->port = *port; msg->opt = htonl (options); @@ -464,7 +464,7 @@ handle_port_close (void *cls, */ static void handle_channel_create (void *cls, - const struct GNUNET_CADET_ChannelCreateMessageMessage *ccm) + const struct GNUNET_CADET_ChannelOpenMessageMessage *ccm) { struct CadetClient *c = cls; struct CadetChannel *ch; @@ -1310,8 +1310,8 @@ GNUNET_SERVICE_MAIN struct GNUNET_CADET_PortMessage, NULL), GNUNET_MQ_hd_fixed_size (channel_create, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - struct GNUNET_CADET_ChannelCreateMessageMessage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, + struct GNUNET_CADET_ChannelOpenMessageMessage, NULL), GNUNET_MQ_hd_fixed_size (channel_destroy, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index fb6379de5..32e4c6269 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -68,10 +68,10 @@ struct ChannelMessageIdentifier /** * Message to create a Channel. */ -struct GNUNET_CADET_ChannelCreateMessage +struct GNUNET_CADET_ChannelOpenMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE + * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN */ struct GNUNET_MessageHeader header; @@ -96,7 +96,7 @@ struct GNUNET_CADET_ChannelCreateMessage /** * Message for cadet data traffic. */ -struct GNUNET_CADET_ChannelDataMessage +struct GNUNET_CADET_ChannelAppDataMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, @@ -126,7 +126,7 @@ struct GNUNET_CADET_ChannelDataMessage struct GNUNET_CADET_ChannelDataAckMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK + * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK */ struct GNUNET_MessageHeader header; @@ -219,7 +219,7 @@ struct CadetReliableMessage /** * Data message we are trying to send. */ - struct GNUNET_CADET_ChannelDataMessage data_message; + struct GNUNET_CADET_ChannelAppDataMessage data_message; /* followed by variable-size payload */ }; @@ -265,8 +265,8 @@ struct CadetChannel /** * Last entry in the tunnel's queue relating to control messages - * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE or - * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK). Used to cancel + * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN or + * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK). Used to cancel * transmission in case we receive updated information. */ struct CadetTunnelQueueEntry *last_control_qe; @@ -531,7 +531,7 @@ static void send_create (void *cls) { struct CadetChannel *ch = cls; - struct GNUNET_CADET_ChannelCreateMessage msgcc; + struct GNUNET_CADET_ChannelOpenMessage msgcc; uint32_t options; options = 0; @@ -542,7 +542,7 @@ send_create (void *cls) if (ch->out_of_order) options |= GNUNET_CADET_OPTION_OUT_OF_ORDER; msgcc.header.size = htons (sizeof (msgcc)); - msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); + msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); msgcc.opt = htonl (options); msgcc.port = ch->port; msgcc.gid = ch->gid; @@ -698,7 +698,7 @@ send_channel_ack (struct CadetChannel *ch) { struct GNUNET_CADET_ChannelDataAckMessage msg; - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); msg.header.size = htons (sizeof (msg)); msg.gid = ch->gid; msg.mid.mid = htonl (ntohl (ch->mid_recv.mid) - 1); @@ -1003,8 +1003,8 @@ GCCH_handle_local_data (struct CadetChannel *ch, /* Everything is correct, send the message. */ crm = GNUNET_malloc (sizeof (*crm) + payload_size); crm->ch = ch; - crm->data_message.header.size = htons (sizeof (struct GNUNET_CADET_ChannelDataMessage) + payload_size); - crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA); + crm->data_message.header.size = htons (sizeof (struct GNUNET_CADET_ChannelAppDataMessage) + payload_size); + crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); ch->mid_send.mid = htonl (ntohl (ch->mid_send.mid) + 1); crm->data_message.mid = ch->mid_send; crm->data_message.gid = ch->gid; diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c index 95342d631..440d64fb6 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.c +++ b/src/cadet/gnunet-service-cadet-new_connection.c @@ -268,7 +268,7 @@ GCC_handle_kx (struct CadetConnection *cc, */ void GCC_handle_encrypted (struct CadetConnection *cc, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { GCT_handle_encrypted (cc->ct, msg); diff --git a/src/cadet/gnunet-service-cadet-new_connection.h b/src/cadet/gnunet-service-cadet-new_connection.h index 440fb9019..32452024c 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.h +++ b/src/cadet/gnunet-service-cadet-new_connection.h @@ -118,7 +118,7 @@ GCC_handle_kx (struct CadetConnection *cc, */ void GCC_handle_encrypted (struct CadetConnection *cc, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); + const struct GNUNET_CADET_TunnelEncryptedMessage *msg); /** diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c index b925200a6..d81600b9d 100644 --- a/src/cadet/gnunet-service-cadet-new_core.c +++ b/src/cadet/gnunet-service-cadet-new_core.c @@ -137,8 +137,8 @@ route_message (struct CadetPeer *prev, * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. */ static int -check_create (void *cls, - const struct GNUNET_CADET_ConnectionCreateMessage *msg) +check_connection_create (void *cls, + const struct GNUNET_CADET_ConnectionCreateMessage *msg) { uint16_t size = ntohs (msg->header.size) - sizeof (*msg); @@ -170,8 +170,8 @@ destroy_route (struct CadetRoute *route) * @param msg Message itself. */ static void -handle_create (void *cls, - const struct GNUNET_CADET_ConnectionCreateMessage *msg) +handle_connection_create (void *cls, + const struct GNUNET_CADET_ConnectionCreateMessage *msg) { struct CadetPeer *peer = cls; uint16_t size = ntohs (msg->header.size) - sizeof (*msg); @@ -235,8 +235,8 @@ handle_connection_ack (void *cls, * @deprecated duplicate logic with #handle_destroy(); dedup! */ static void -handle_broken (void *cls, - const struct GNUNET_CADET_ConnectionBrokenMessage *msg) +handle_connection_broken (void *cls, + const struct GNUNET_CADET_ConnectionBrokenMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -281,8 +281,8 @@ handle_broken (void *cls, * @param msg Message itself. */ static void -handle_destroy (void *cls, - const struct GNUNET_CADET_ConnectionDestroyMessage *msg) +handle_connection_destroy (void *cls, + const struct GNUNET_CADET_ConnectionDestroyMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -318,26 +318,26 @@ handle_destroy (void *cls, /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_HOP_BY_HOP_ENCRYPTED_ACK. * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_ack (void *cls, - const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) +handle_hop_by_hop_encrypted_ack (void *cls, + const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) { struct CadetPeer *peer = cls; #if FIXME - GCC_handle_ack (peer, - msg); + GCC_handle_poll (peer, + msg); #endif } /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. @@ -362,8 +362,8 @@ handle_poll (void *cls, * @param msg Message itself. */ static void -handle_kx (void *cls, - const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) +handle_tunnel_kx (void *cls, + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -405,22 +405,22 @@ handle_kx (void *cls, * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. */ static int -check_encrypted (void *cls, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) +check_tunnel_encrypted (void *cls, + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { return GNUNET_YES; } /** - * Handle for #GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED. + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED. * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_encrypted (void *cls, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) +handle_tunnel_encrypted (void *cls, + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -532,7 +532,7 @@ void GCO_init (const struct GNUNET_CONFIGURATION_Handle *c) { struct GNUNET_MQ_MessageHandler handlers[] = { - GNUNET_MQ_hd_var_size (create, + GNUNET_MQ_hd_var_size (connection_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, struct GNUNET_CADET_ConnectionCreateMessage, NULL), @@ -540,29 +540,29 @@ GCO_init (const struct GNUNET_CONFIGURATION_Handle *c) GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, struct GNUNET_CADET_ConnectionCreateMessageAckMessage, NULL), - GNUNET_MQ_hd_fixed_size (broken, + GNUNET_MQ_hd_fixed_size (connection_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, struct GNUNET_CADET_ConnectionBrokenMessage, NULL), - GNUNET_MQ_hd_fixed_size (destroy, + GNUNET_MQ_hd_fixed_size (connection_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, struct GNUNET_CADET_ConnectionDestroyMessage, NULL), - GNUNET_MQ_hd_fixed_size (ack, - GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK, + GNUNET_MQ_hd_fixed_size (hop_by_hop_encrypted_ack, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK, struct GNUNET_CADET_ConnectionEncryptedAckMessage, NULL), GNUNET_MQ_hd_fixed_size (poll, - GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL, struct GNUNET_CADET_ConnectionHopByHopPollMessage, NULL), - GNUNET_MQ_hd_fixed_size (kx, + GNUNET_MQ_hd_fixed_size (tunnel_kx, GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, struct GNUNET_CADET_TunnelKeyExchangeMessage, NULL), - GNUNET_MQ_hd_var_size (encrypted, - GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED, - struct GNUNET_CADET_ConnectionEncryptedMessage, + GNUNET_MQ_hd_var_size (tunnel_encrypted, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED, + struct GNUNET_CADET_TunnelEncryptedMessage, NULL), GNUNET_MQ_handler_end () }; diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index 2425a4503..d874011aa 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c @@ -762,7 +762,7 @@ t_ax_decrypt (struct CadetTunnel *t, */ static void t_h_encrypt (struct CadetTunnel *t, - struct GNUNET_CADET_ConnectionEncryptedMessage *msg) + struct GNUNET_CADET_TunnelEncryptedMessage *msg) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -791,8 +791,8 @@ t_h_encrypt (struct CadetTunnel *t, */ static void t_h_decrypt (struct CadetTunnel *t, - const struct GNUNET_CADET_ConnectionEncryptedMessage *src, - struct GNUNET_CADET_ConnectionEncryptedMessage *dst) + const struct GNUNET_CADET_TunnelEncryptedMessage *src, + struct GNUNET_CADET_TunnelEncryptedMessage *dst) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -843,13 +843,13 @@ delete_skipped_key (struct CadetTunnel *t, static ssize_t try_old_ax_keys (struct CadetTunnel *t, void *dst, - const struct GNUNET_CADET_ConnectionEncryptedMessage *src, + const struct GNUNET_CADET_TunnelEncryptedMessage *src, size_t size) { struct CadetTunnelSkippedKey *key; struct GNUNET_ShortHashCode *hmac; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; - struct GNUNET_CADET_ConnectionEncryptedMessage plaintext_header; + struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; struct GNUNET_CRYPTO_SymmetricSessionKey *valid_HK; size_t esize; size_t res; @@ -859,7 +859,7 @@ try_old_ax_keys (struct CadetTunnel *t, LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying skipped keys\n"); hmac = &plaintext_header.hmac; - esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); /* Find a correct Header Key */ valid_HK = NULL; @@ -882,8 +882,8 @@ try_old_ax_keys (struct CadetTunnel *t, return -1; /* Should've been checked in -cadet_connection.c handle_cadet_encrypted. */ - GNUNET_assert (size > sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage)); - len = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + GNUNET_assert (size > sizeof (struct GNUNET_CADET_TunnelEncryptedMessage)); + len = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); GNUNET_assert (len >= sizeof (struct GNUNET_MessageHeader)); /* Decrypt header */ @@ -1021,18 +1021,18 @@ store_ax_keys (struct CadetTunnel *t, static ssize_t t_ax_decrypt_and_validate (struct CadetTunnel *t, void *dst, - const struct GNUNET_CADET_ConnectionEncryptedMessage *src, + const struct GNUNET_CADET_TunnelEncryptedMessage *src, size_t size) { struct CadetTunnelAxolotl *ax; struct GNUNET_ShortHashCode msg_hmac; struct GNUNET_HashCode hmac; - struct GNUNET_CADET_ConnectionEncryptedMessage plaintext_header; + struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; uint32_t Np; uint32_t PNp; size_t esize; /* Size of encryped payload */ - esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); ax = &t->ax; /* Try current HK */ @@ -1411,7 +1411,7 @@ handle_plaintext_keepalive (void *cls, */ static int check_plaintext_data (void *cls, - const struct GNUNET_CADET_ChannelDataMessage *msg) + const struct GNUNET_CADET_ChannelAppDataMessage *msg) { return GNUNET_OK; } @@ -1425,7 +1425,7 @@ check_plaintext_data (void *cls, */ static void handle_plaintext_data (void *cls, - const struct GNUNET_CADET_ChannelDataMessage *msg) + const struct GNUNET_CADET_ChannelAppDataMessage *msg) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1455,7 +1455,7 @@ handle_plaintext_data_ack (void *cls, */ static void handle_plaintext_channel_create (void *cls, - const struct GNUNET_CADET_ChannelCreateMessage *cc) + const struct GNUNET_CADET_ChannelOpenMessage *cc) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1558,23 +1558,23 @@ GCT_create_tunnel (struct CadetPeer *destination) struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_var_size (plaintext_data, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA, - struct GNUNET_CADET_ChannelDataMessage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA, + struct GNUNET_CADET_ChannelAppDataMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_data_ack, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK, struct GNUNET_CADET_ChannelDataAckMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_create, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - struct GNUNET_CADET_ChannelCreateMessage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, + struct GNUNET_CADET_ChannelOpenMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_nack, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED, struct GNUNET_CADET_ChannelManageMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_ack, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, struct GNUNET_CADET_ChannelManageMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, @@ -1692,7 +1692,7 @@ GCT_handle_kx (struct CadetTConnection *ct, */ void GCT_handle_encrypted (struct CadetTConnection *ct, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { struct CadetTunnel *t = ct->t; uint16_t size = ntohs (msg->header.size); @@ -1758,14 +1758,14 @@ GCT_send (struct CadetTunnel *t, struct CadetTunnelQueueEntry *tq; uint16_t payload_size; struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_ConnectionEncryptedMessage *ax_msg; + struct GNUNET_CADET_TunnelEncryptedMessage *ax_msg; /* FIXME: what about KX not yet being ready? (see "is_ready()" check in old code!) */ payload_size = ntohs (message->size); env = GNUNET_MQ_msg_extra (ax_msg, payload_size, - GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED); + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED); t_ax_encrypt (t, &ax_msg[1], message, diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.h b/src/cadet/gnunet-service-cadet-new_tunnels.h index d565077b0..59a5a1958 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.h +++ b/src/cadet/gnunet-service-cadet-new_tunnels.h @@ -336,7 +336,7 @@ GCT_handle_kx (struct CadetTConnection *ct, */ void GCT_handle_encrypted (struct CadetTConnection *ct, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); + const struct GNUNET_CADET_TunnelEncryptedMessage *msg); /** diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index eff6af40b..20ed582bd 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -125,7 +125,7 @@ struct CadetReliableMessage */ struct GNUNET_TIME_Absolute timestamp; - /* struct GNUNET_CADET_ChannelDataMessage with payload */ + /* struct GNUNET_CADET_ChannelAppDataMessage with payload */ }; @@ -368,7 +368,7 @@ is_loopback (const struct CadetChannel *ch) * @param rel Reliability data for retransmission. */ static struct CadetReliableMessage * -copy_message (const struct GNUNET_CADET_ChannelDataMessage *msg, uint32_t mid, +copy_message (const struct GNUNET_CADET_ChannelAppDataMessage *msg, uint32_t mid, struct CadetChannelReliability *rel) { struct CadetReliableMessage *copy; @@ -378,7 +378,7 @@ copy_message (const struct GNUNET_CADET_ChannelDataMessage *msg, uint32_t mid, copy = GNUNET_malloc (sizeof (*copy) + size); copy->mid = mid; copy->rel = rel; - copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA; + copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA; GNUNET_memcpy (©[1], msg, size); return copy; @@ -393,7 +393,7 @@ copy_message (const struct GNUNET_CADET_ChannelDataMessage *msg, uint32_t mid, * @param rel Reliability data to the corresponding direction. */ static void -add_buffered_data (const struct GNUNET_CADET_ChannelDataMessage *msg, +add_buffered_data (const struct GNUNET_CADET_ChannelAppDataMessage *msg, struct CadetChannelReliability *rel) { struct CadetReliableMessage *copy; @@ -573,7 +573,7 @@ send_client_create (struct CadetChannel *ch) */ static void send_client_data (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, int fwd) { if (fwd) @@ -631,7 +631,7 @@ send_client_buffered_data (struct CadetChannel *ch, { if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) { - struct GNUNET_CADET_ChannelDataMessage *msg = (struct GNUNET_CADET_ChannelDataMessage *) ©[1]; + struct GNUNET_CADET_ChannelAppDataMessage *msg = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1]; LOG (GNUNET_ERROR_TYPE_DEBUG, " have %u! now expecting %u\n", copy->mid, rel->mid_recv + 1); @@ -731,7 +731,7 @@ channel_retransmit_message (void *cls) struct CadetChannelReliability *rel = cls; struct CadetReliableMessage *copy; struct CadetChannel *ch; - struct GNUNET_CADET_ChannelDataMessage *payload; + struct GNUNET_CADET_ChannelAppDataMessage *payload; int fwd; rel->retry_task = NULL; @@ -743,7 +743,7 @@ channel_retransmit_message (void *cls) return; } - payload = (struct GNUNET_CADET_ChannelDataMessage *) ©[1]; + payload = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1]; fwd = (rel == ch->root_rel); /* Message not found in the queue that we are going to use. */ @@ -808,7 +808,7 @@ ch_message_sent (void *cls, switch (chq->type) { - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: LOG (GNUNET_ERROR_TYPE_DEBUG, "data MID %u sent\n", copy->mid); GNUNET_assert (chq == copy->chq); copy->timestamp = GNUNET_TIME_absolute_get (); @@ -844,16 +844,16 @@ ch_message_sent (void *cls, break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: LOG (GNUNET_ERROR_TYPE_DEBUG, "sent %s\n", GC_m2s (chq->type)); rel = chq->rel; GNUNET_assert (rel->uniq == chq); rel->uniq = NULL; if (CADET_CHANNEL_READY != rel->ch->state - && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK != type + && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK != type && GNUNET_NO == rel->ch->destroy) { GNUNET_assert (NULL == rel->retry_task); @@ -882,10 +882,10 @@ ch_message_sent (void *cls, static void send_create (struct CadetChannel *ch) { - struct GNUNET_CADET_ChannelCreateMessage msgcc; + struct GNUNET_CADET_ChannelOpenMessage msgcc; msgcc.header.size = htons (sizeof (msgcc)); - msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); + msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); msgcc.chid = ch->gid; msgcc.port = ch->port; msgcc.opt = htonl (channel_get_options (ch)); @@ -906,7 +906,7 @@ send_ack (struct CadetChannel *ch, int fwd) struct GNUNET_CADET_ChannelManageMessage msg; msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", GC_f2s (fwd), GCCH_2s (ch)); @@ -946,7 +946,7 @@ send_nack (struct CadetChannel *ch) struct GNUNET_CADET_ChannelManageMessage msg; msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel NACK for channel %s\n", GCCH_2s (ch)); @@ -1300,29 +1300,29 @@ handle_loopback (struct CadetChannel *ch, switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: /* Don't send hop ACK, wait for client to ACK */ LOG (GNUNET_ERROR_TYPE_DEBUG, "SEND loopback %u (%u)\n", - ntohl (((struct GNUNET_CADET_ChannelDataMessage *) msgh)->mid), ntohs (msgh->size)); - GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelDataMessage *) msgh, fwd); + ntohl (((struct GNUNET_CADET_ChannelAppDataMessage *) msgh)->mid), ntohs (msgh->size)); + GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelAppDataMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: GCCH_handle_data_ack (ch, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: GCCH_handle_create (ch->t, - (struct GNUNET_CADET_ChannelCreateMessage *) msgh); + (struct GNUNET_CADET_ChannelOpenMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: GCCH_handle_ack (ch, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: GCCH_handle_nack (ch); break; @@ -1536,7 +1536,7 @@ GCCH_send_data_ack (struct CadetChannel *ch, int fwd) rel = fwd ? ch->dest_rel : ch->root_rel; ack = rel->mid_recv - 1; - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); msg.header.size = htons (sizeof (msg)); msg.chid = ch->gid; msg.mid = htonl (ack); @@ -1544,7 +1544,7 @@ GCCH_send_data_ack (struct CadetChannel *ch, int fwd) msg.futures = 0LL; for (copy = rel->head_recv; NULL != copy; copy = copy->next) { - if (copy->type != GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA) + if (copy->type != GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA) { LOG (GNUNET_ERROR_TYPE_DEBUG, " Type %s, expected DATA\n", GC_m2s (copy->type)); @@ -1748,8 +1748,8 @@ GCCH_handle_local_data (struct CadetChannel *ch, size_t size) { struct CadetChannelReliability *rel; - struct GNUNET_CADET_ChannelDataMessage *payload; - uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelDataMessage) + size; + struct GNUNET_CADET_ChannelAppDataMessage *payload; + uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelAppDataMessage) + size; unsigned char cbuf[p2p_size]; unsigned char buffer; @@ -1775,12 +1775,12 @@ GCCH_handle_local_data (struct CadetChannel *ch, rel->client_allowed = GNUNET_NO; /* Ok, everything is correct, send the message. */ - payload = (struct GNUNET_CADET_ChannelDataMessage *) cbuf; + payload = (struct GNUNET_CADET_ChannelAppDataMessage *) cbuf; payload->mid = htonl (rel->mid_send); rel->mid_send++; GNUNET_memcpy (&payload[1], message, size); payload->header.size = htons (p2p_size); - payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA); + payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); payload->chid = ch->gid; LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); @@ -1846,7 +1846,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, */ int GCCH_handle_local_create (struct CadetClient *c, - struct GNUNET_CADET_ChannelCreateMessageMessage *msg) + struct GNUNET_CADET_ChannelOpenMessageMessage *msg) { struct CadetChannel *ch; struct CadetTunnel *t; @@ -1914,7 +1914,7 @@ GCCH_handle_local_create (struct CadetClient *c, */ void GCCH_handle_data (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, int fwd) { struct CadetChannelReliability *rel; @@ -1972,7 +1972,7 @@ GCCH_handle_data (struct CadetChannel *ch, mid = ntohl (msg->mid); LOG (GNUNET_ERROR_TYPE_INFO, "<== %s (%s %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA), GC_m2s (payload_type), mid, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA), GC_m2s (payload_type), mid, GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); if ( (GNUNET_NO == ch->reliable) || @@ -2069,7 +2069,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, ack = ntohl (msg->mid); LOG (GNUNET_ERROR_TYPE_INFO, "<== %s (0x%010lX %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK), msg->futures, ack, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK), msg->futures, ack, GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); if (GNUNET_YES == fwd) @@ -2151,7 +2151,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, */ struct CadetChannel * GCCH_handle_create (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelCreateMessage *msg) + const struct GNUNET_CADET_ChannelOpenMessage *msg) { struct GNUNET_CADET_ClientChannelNumber chid; struct GNUNET_CADET_ChannelNumber gid; @@ -2179,7 +2179,7 @@ GCCH_handle_create (struct CadetTunnel *t, LOG (GNUNET_ERROR_TYPE_INFO, "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE), chid, port, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN), chid, port, GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size)); if (GNUNET_YES == new_channel || GCT_is_loopback (t)) @@ -2252,7 +2252,7 @@ GCCH_handle_nack (struct CadetChannel *ch) { LOG (GNUNET_ERROR_TYPE_INFO, "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED), ch->gid, 0, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED), ch->gid, 0, GCCH_2s (ch), ch, "---", 0); send_client_nack (ch); @@ -2277,7 +2277,7 @@ GCCH_handle_ack (struct CadetChannel *ch, { LOG (GNUNET_ERROR_TYPE_INFO, "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK), ch->gid, 0, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK), ch->gid, 0, GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); /* If this is a remote (non-loopback) channel, find 'fwd'. */ @@ -2383,13 +2383,13 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, data_id = 0; switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: { - struct GNUNET_CADET_ChannelDataMessage *data_msg; + struct GNUNET_CADET_ChannelAppDataMessage *data_msg; struct GNUNET_MessageHeader *payload_msg; uint16_t payload_type; - data_msg = (struct GNUNET_CADET_ChannelDataMessage *) message; + data_msg = (struct GNUNET_CADET_ChannelAppDataMessage *) message; data_id = ntohl (data_msg->mid); payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1]; payload_type = ntohs (payload_msg->type); @@ -2397,7 +2397,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, info[31] = '\0'; break; } - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: { struct GNUNET_CADET_ChannelDataAckMessage *ack_msg; ack_msg = (struct GNUNET_CADET_ChannelDataAckMessage *) message; @@ -2406,15 +2406,15 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, (unsigned long int) ack_msg->futures); break; } - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: { - struct GNUNET_CADET_ChannelCreateMessage *cc_msg; - cc_msg = (struct GNUNET_CADET_ChannelCreateMessage *) message; + struct GNUNET_CADET_ChannelOpenMessage *cc_msg; + cc_msg = (struct GNUNET_CADET_ChannelOpenMessage *) message; SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid.cn)); break; } - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: { struct GNUNET_CADET_ChannelManageMessage *m_msg; @@ -2438,7 +2438,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: if (GNUNET_YES == ch->reliable) { chq = GNUNET_new (struct CadetChannelQueue); @@ -2484,9 +2484,9 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: chq = GNUNET_new (struct CadetChannelQueue); chq->type = type; chq->rel = fwd ? ch->root_rel : ch->dest_rel; @@ -2521,7 +2521,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: fire_and_forget (message, ch, GNUNET_YES); break; diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index c6a1df9ff..9e887362b 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h @@ -224,7 +224,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, */ int GCCH_handle_local_create (struct CadetClient *c, - struct GNUNET_CADET_ChannelCreateMessageMessage *msg); + struct GNUNET_CADET_ChannelOpenMessageMessage *msg); /** * Handler for cadet network payload traffic. @@ -238,7 +238,7 @@ GCCH_handle_local_create (struct CadetClient *c, */ void GCCH_handle_data (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, int fwd); @@ -268,7 +268,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, */ struct CadetChannel * GCCH_handle_create (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelCreateMessage *msg); + const struct GNUNET_CADET_ChannelOpenMessage *msg); /** diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 4eed0ec1c..931b32b95 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -616,7 +616,7 @@ send_ack (struct CadetConnection *c, /* Build ACK message and send on conn */ msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK); msg.cemi = ack_cemi; msg.cid = c->id; @@ -747,7 +747,7 @@ conn_message_sent (void *cls, } else /* CONN_CREATE or CONN_ACK */ { - GNUNET_assert (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED != type); + GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED != type); forced = GNUNET_YES; } @@ -774,7 +774,7 @@ conn_message_sent (void *cls, schedule_next_keepalive (c, fwd); break; - case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: if (GNUNET_YES == sent) { fc->last_pid_sent = pid; @@ -806,7 +806,7 @@ conn_message_sent (void *cls, connection_reset_timeout (c, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: fc->poll_msg = NULL; if (2 == c->destroy) { @@ -827,7 +827,7 @@ conn_message_sent (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, " task %u\n", fc->poll_task); break; - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: fc->ack_msg = NULL; break; @@ -1469,7 +1469,7 @@ send_poll (void *cls) LOG (GNUNET_ERROR_TYPE_DEBUG, "Polling connection %s %s\n", GCC_2s (c), GC_f2s (fwd)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL); msg.header.size = htons (sizeof (msg)); msg.cid = c->id; msg.cemi = fc->last_pid_sent; @@ -2531,7 +2531,7 @@ check_message (const struct GNUNET_MessageHeader *message, /* Check PID for payload messages */ type = ntohs (message->type); - if (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED == type) + if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == type) { fc = fwd ? &c->bck_fc : &c->fwd_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected in interval [%u,%u])\n", @@ -2665,7 +2665,7 @@ GCC_handle_kx (struct CadetPeer *peer, */ void GCC_handle_encrypted (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { static struct CadetEncryptedMessageIdentifier zero; const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid; @@ -3302,7 +3302,7 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, GC_f2s(fwd), size); switch (type) { - case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u, PIDsnt: %u, ACKrcv: %u\n", fc, fc->queue_n, @@ -3324,8 +3324,8 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, GNUNET_break (0 == payload_type); break; - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: GNUNET_assert (GNUNET_YES == force); @@ -3343,7 +3343,7 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, GNUNET_break (0); LOG (GNUNET_ERROR_TYPE_DEBUG, "queue full: %u/%u\n", fc->queue_n, fc->queue_max); - if (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED == type) + if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == type) { fc->queue_n--; } diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index ab2920ba3..1c3160dfd 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h @@ -197,7 +197,7 @@ GCC_handle_kx (struct CadetPeer *peer, */ void GCC_handle_encrypted (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); + const struct GNUNET_CADET_TunnelEncryptedMessage *msg); /** * Core handler for axolotl key exchange traffic. diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c index 40d7e26dc..7ba7077aa 100644 --- a/src/cadet/gnunet-service-cadet_local.c +++ b/src/cadet/gnunet-service-cadet_local.c @@ -440,7 +440,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); /* Message size sanity check */ - if (sizeof (struct GNUNET_CADET_ChannelCreateMessageMessage) + if (sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage) != ntohs (message->size)) { GNUNET_break (0); @@ -450,7 +450,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, if (GNUNET_OK != GCCH_handle_local_create (c, - (struct GNUNET_CADET_ChannelCreateMessageMessage *) + (struct GNUNET_CADET_ChannelOpenMessageMessage *) message)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -1128,8 +1128,8 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { sizeof (struct GNUNET_CADET_PortMessage)}, {&handle_port_close, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, sizeof (struct GNUNET_CADET_PortMessage)}, - {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - sizeof (struct GNUNET_CADET_ChannelCreateMessageMessage)}, + {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, + sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage)}, {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, sizeof (struct GNUNET_CADET_ChannelDestroyMessage)}, {&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0}, @@ -1434,10 +1434,10 @@ GML_send_channel_create (struct CadetClient *c, uint32_t opt, const struct GNUNET_PeerIdentity *peer) { - struct GNUNET_CADET_ChannelCreateMessageMessage msg; + struct GNUNET_CADET_ChannelOpenMessageMessage msg; msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); msg.channel_id = id; msg.port = *port; msg.opt = htonl (opt); @@ -1465,7 +1465,7 @@ GML_send_channel_nack (struct CadetClient *c, c); msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED); msg.channel_id = id; GNUNET_SERVER_notification_context_unicast (nc, c->handle, @@ -1510,11 +1510,11 @@ GML_send_channel_destroy (struct CadetClient *c, */ void GML_send_data (struct CadetClient *c, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, struct GNUNET_CADET_ClientChannelNumber id) { struct GNUNET_CADET_LocalData *copy; - uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_ChannelDataMessage); + uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_ChannelAppDataMessage); char cbuf[size + sizeof (struct GNUNET_CADET_LocalData)]; if (size < sizeof (struct GNUNET_MessageHeader)) diff --git a/src/cadet/gnunet-service-cadet_local.h b/src/cadet/gnunet-service-cadet_local.h index 9428cd4b9..bf691f9c3 100644 --- a/src/cadet/gnunet-service-cadet_local.h +++ b/src/cadet/gnunet-service-cadet_local.h @@ -208,7 +208,7 @@ GML_send_channel_destroy (struct CadetClient *c, */ void GML_send_data (struct CadetClient *c, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, struct GNUNET_CADET_ClientChannelNumber id); /** diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 2b11040a5..3f8b7bbb8 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -526,7 +526,7 @@ handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroyMessage *m /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. @@ -540,7 +540,7 @@ handle_ack (void *cls, const struct GNUNET_CADET_ConnectionEncryptedAckMessage * /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. @@ -576,13 +576,13 @@ handle_kx (void *cls, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. */ static int -check_encrypted (void *cls, const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) +check_encrypted (void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { uint16_t size; uint16_t minimum_size; size = ntohs (msg->header.size); - minimum_size = sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + minimum_size = sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + sizeof (struct GNUNET_MessageHeader); if (size < minimum_size) @@ -594,13 +594,13 @@ check_encrypted (void *cls, const struct GNUNET_CADET_ConnectionEncryptedMessage } /** - * Handle for #GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED. + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED. * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_encrypted (void *cls, const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) +handle_encrypted (void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_encrypted (peer, msg); @@ -639,11 +639,11 @@ connect_to_core (const struct GNUNET_CONFIGURATION_Handle *c) struct GNUNET_CADET_ConnectionDestroyMessage, NULL), GNUNET_MQ_hd_fixed_size (ack, - GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK, struct GNUNET_CADET_ConnectionEncryptedAckMessage, NULL), GNUNET_MQ_hd_fixed_size (poll, - GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL, struct GNUNET_CADET_ConnectionHopByHopPollMessage, NULL), GNUNET_MQ_hd_fixed_size (kx, @@ -651,8 +651,8 @@ connect_to_core (const struct GNUNET_CONFIGURATION_Handle *c) struct GNUNET_CADET_TunnelKeyExchangeMessage, NULL), GNUNET_MQ_hd_var_size (encrypted, - GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED, - struct GNUNET_CADET_ConnectionEncryptedMessage, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED, + struct GNUNET_CADET_TunnelEncryptedMessage, NULL), GNUNET_MQ_handler_end () }; @@ -735,7 +735,7 @@ get_priority (struct CadetPeerQueue *q) } /* Bulky payload has lower priority, control traffic has higher. */ - if (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED == q->type) + if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == q->type) return low; return high; } @@ -1059,8 +1059,8 @@ search_handler (void *cls, const struct CadetPeerPath *path) static int is_connection_management (uint16_t type) { - return type == GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK || - type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL; + return type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK || + type == GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL; } diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 5e0f5bf4f..b2d91c995 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c @@ -843,7 +843,7 @@ t_ax_decrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) * @param msg Message whose header to encrypt. */ static void -t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_ConnectionEncryptedMessage *msg) +t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_TunnelEncryptedMessage *msg) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -874,8 +874,8 @@ t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_ConnectionEncryptedMessa * @param dst Where to decrypt header to. */ static void -t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_ConnectionEncryptedMessage *src, - struct GNUNET_CADET_ConnectionEncryptedMessage *dst) +t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_TunnelEncryptedMessage *src, + struct GNUNET_CADET_TunnelEncryptedMessage *dst) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -913,12 +913,12 @@ t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_ConnectionEncrypte */ static int try_old_ax_keys (struct CadetTunnel *t, void *dst, - const struct GNUNET_CADET_ConnectionEncryptedMessage *src, size_t size) + const struct GNUNET_CADET_TunnelEncryptedMessage *src, size_t size) { struct CadetTunnelSkippedKey *key; struct GNUNET_ShortHashCode *hmac; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; - struct GNUNET_CADET_ConnectionEncryptedMessage plaintext_header; + struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; struct GNUNET_CRYPTO_SymmetricSessionKey *valid_HK; size_t esize; size_t res; @@ -927,7 +927,7 @@ try_old_ax_keys (struct CadetTunnel *t, void *dst, LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying old keys\n"); hmac = &plaintext_header.hmac; - esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); /* Find a correct Header Key */ for (key = t->ax->skipped_head; NULL != key; key = key->next) @@ -948,8 +948,8 @@ try_old_ax_keys (struct CadetTunnel *t, void *dst, return -1; /* Should've been checked in -cadet_connection.c handle_cadet_encrypted. */ - GNUNET_assert (size > sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage)); - len = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + GNUNET_assert (size > sizeof (struct GNUNET_CADET_TunnelEncryptedMessage)); + len = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); GNUNET_assert (len >= sizeof (struct GNUNET_MessageHeader)); /* Decrypt header */ @@ -1092,19 +1092,19 @@ store_ax_keys (struct CadetTunnel *t, */ static int t_ax_decrypt_and_validate (struct CadetTunnel *t, void *dst, - const struct GNUNET_CADET_ConnectionEncryptedMessage *src, + const struct GNUNET_CADET_TunnelEncryptedMessage *src, size_t size) { struct CadetTunnelAxolotl *ax; struct GNUNET_ShortHashCode msg_hmac; struct GNUNET_HashCode hmac; - struct GNUNET_CADET_ConnectionEncryptedMessage plaintext_header; + struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; uint32_t Np; uint32_t PNp; size_t esize; /* Size of encryped payload */ size_t osize; /* Size of output (decrypted payload) */ - esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); ax = t->ax; if (NULL == ax) return -1; @@ -1322,10 +1322,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetTunnelQueue *existing_q) { struct GNUNET_MessageHeader *msg; - struct GNUNET_CADET_ConnectionEncryptedMessage *ax_msg; + struct GNUNET_CADET_TunnelEncryptedMessage *ax_msg; struct CadetTunnelQueue *tq; size_t size = ntohs (message->size); - char cbuf[sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + size] GNUNET_ALIGN; + char cbuf[sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + size] GNUNET_ALIGN; size_t esize; uint16_t type; int fwd; @@ -1352,10 +1352,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); - ax_msg = (struct GNUNET_CADET_ConnectionEncryptedMessage *) cbuf; + ax_msg = (struct GNUNET_CADET_TunnelEncryptedMessage *) cbuf; msg = &ax_msg->header; - msg->size = htons (sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + size); - msg->type = htons (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED); + msg->size = htons (sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + size); + msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED); esize = t_ax_encrypt (t, &ax_msg[1], message, size); ax_msg->Ns = htonl (t->ax->Ns++); ax_msg->PNs = htonl (t->ax->PNs); @@ -1584,7 +1584,7 @@ send_channel_destroy (struct CadetTunnel *t, */ static void handle_data (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelDataMessage *msg, + const struct GNUNET_CADET_ChannelAppDataMessage *msg, int fwd) { struct CadetChannel *ch; @@ -1595,7 +1595,7 @@ handle_data (struct CadetTunnel *t, /* Check size */ size = ntohs (msg->header.size); if (size < - sizeof (struct GNUNET_CADET_ChannelDataMessage) + + sizeof (struct GNUNET_CADET_ChannelAppDataMessage) + sizeof (struct GNUNET_MessageHeader)) { GNUNET_break (0); @@ -1675,14 +1675,14 @@ handle_data_ack (struct CadetTunnel *t, */ static void handle_ch_create (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelCreateMessage *msg) + const struct GNUNET_CADET_ChannelOpenMessage *msg) { struct CadetChannel *ch; size_t size; /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_ChannelCreateMessage)) + if (size != sizeof (struct GNUNET_CADET_ChannelOpenMessage)) { GNUNET_break_op (0); return; @@ -1885,24 +1885,24 @@ handle_decrypted (struct CadetTunnel *t, GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: /* Don't send hop ACK, wait for client to ACK */ - handle_data (t, (struct GNUNET_CADET_ChannelDataMessage *) msgh, fwd); + handle_data (t, (struct GNUNET_CADET_ChannelAppDataMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: handle_data_ack (t, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - handle_ch_create (t, (struct GNUNET_CADET_ChannelCreateMessage *) msgh); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: + handle_ch_create (t, (struct GNUNET_CADET_ChannelOpenMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: handle_ch_nack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: handle_ch_ack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; @@ -1934,7 +1934,7 @@ handle_decrypted (struct CadetTunnel *t, */ void GCT_handle_encrypted (struct CadetTunnel *t, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) + const struct GNUNET_CADET_TunnelEncryptedMessage *msg) { uint16_t size = ntohs (msg->header.size); char cbuf [size]; @@ -2146,8 +2146,8 @@ GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); expected_overhead = 0; - expected_overhead += sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); - expected_overhead += sizeof (struct GNUNET_CADET_ChannelDataMessage); + expected_overhead += sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); + expected_overhead += sizeof (struct GNUNET_CADET_ChannelAppDataMessage); expected_overhead += sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage); GNUNET_assert (GNUNET_CONSTANTS_CADET_P2P_OVERHEAD == expected_overhead); diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index 8d3d28f8d..65f54e373 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h @@ -304,7 +304,7 @@ GCT_get_channel (struct CadetTunnel *t, struct GNUNET_CADET_ChannelNumber chid); */ void GCT_handle_encrypted (struct CadetTunnel *t, - const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); + const struct GNUNET_CADET_TunnelEncryptedMessage *msg); /** diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index 336184589..1d0232cea 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h @@ -127,8 +127,8 @@ extern "C" /** * Size of the CADET message overhead: - * = sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) - * + sizeof (struct GNUNET_CADET_ChannelDataMessage) + * = sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + * + sizeof (struct GNUNET_CADET_ChannelAppDataMessage) * + sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage)) * * Checked for correcteness in gnunet-service-cadet_tunnel.c: GCT_init(). diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 4962a944a..e8f5ead37 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -2652,34 +2652,38 @@ extern "C" /** * Hop-by-hop, connection dependent ACK. */ -#define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK 1005 +#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK 1005 /** - * Poll for a hop-by-hop ACK. + * Axolotl key exchange. */ -#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL 1006 +#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX 1007 /** - * Key exchange encapsulation. + * Axolotl encrypted data. */ -#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX 1007 +#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED 1008 /** - * Axolotl encrypted data. + * We do not bother with ACKs for + * #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED messages, but we instead + * poll for one if we got nothing for a while and start to be worried. */ -#define GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED 1008 +#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL 1006 + + /********************************** Channel *********************************/ /** * Payload data (inside an encrypted tunnel). */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA 1010 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA 1010 /** * Confirm payload data end-to-end. */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK 1011 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK 1011 /** * Announce connection is still alive (direction sensitive). @@ -2689,7 +2693,7 @@ extern "C" /** * Ask the cadet service to create a new channel. */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE 1013 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN 1013 /** * Ask the cadet service to destroy a channel. @@ -2699,12 +2703,12 @@ extern "C" /** * Confirm the creation of a channel */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK 1015 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK 1015 /** * Reject the creation of a channel */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED 1016 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED 1016 /*********************************** Local **********************************/ diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index 1e372bbea..c1e0d005c 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h @@ -150,11 +150,6 @@ extern "C" */ #define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20 -/** - * Key exchange in CADET - */ -#define GNUNET_SIGNATURE_PURPOSE_CADET_KX 21 - /** * Signature for the first round of distributed key generation. */ -- cgit v1.2.3