From: Christian Grothoff Date: Wed, 18 Jan 2017 09:51:16 +0000 (+0100) Subject: cadet message struct and type rename-fest X-Git-Tag: taler-0.2.1~417 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a1bd2dcc29c126023dbd1ddf83d7514859d1775b;p=oweals%2Fgnunet.git cadet message struct and type rename-fest --- diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index df8803662..8218fd1ed 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_ChannelCreateMessage +struct GNUNET_CADET_ChannelCreateMessageMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE * - * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessage) + * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessageMessage) */ struct GNUNET_MessageHeader header; diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 57a14639d..281d8c5f3 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_ChannelCreateMessage *msg) + const struct GNUNET_CADET_ChannelCreateMessageMessage *msg) { struct GNUNET_CADET_Handle *h = cls; struct GNUNET_CADET_Channel *ch; @@ -1282,7 +1282,7 @@ 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_ChannelCreateMessage, + struct GNUNET_CADET_ChannelCreateMessageMessage, 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_NACK, +// GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED, // struct GNUNET_CADET_ChannelDestroyMessage); GNUNET_MQ_handler_end () }; @@ -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_ChannelCreateMessage *msg; + struct GNUNET_CADET_ChannelCreateMessageMessage *msg; struct GNUNET_MQ_Envelope *env; struct GNUNET_CADET_Channel *ch; struct GNUNET_CADET_ClientChannelNumber chid; diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c index 9a0c58d48..0606aac50 100644 --- a/src/cadet/cadet_common.c +++ b/src/cadet/cadet_common.c @@ -146,7 +146,7 @@ GC_m2s (uint16_t m) /** * Request the modification of an existing path */ - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: s = "CONN_ACK"; break; @@ -160,35 +160,35 @@ GC_m2s (uint16_t m) /** * At some point, the route will spontaneously change */ - case GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTED: s = "PATH_CHNGD"; break; /** * Transport payload data. */ - case GNUNET_MESSAGE_TYPE_CADET_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: s = "DATA"; break; /** * Confirm receipt of payload data. */ - case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: s = "DATA_ACK"; break; /** * Key exchange message. */ - case GNUNET_MESSAGE_TYPE_CADET_KX: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: s = "KX"; break; /** * Encrypted. */ - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: s = "ENCRYPTED"; break; @@ -202,21 +202,21 @@ GC_m2s (uint16_t m) /** * ACK for a data packet. */ - case GNUNET_MESSAGE_TYPE_CADET_ACK: + case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK: s = "ACK"; break; /** * POLL for ACK. */ - case GNUNET_MESSAGE_TYPE_CADET_POLL: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL: s = "POLL"; break; /** * Announce origin is still alive. */ - case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE: s = "KEEPALIVE"; break; @@ -251,14 +251,14 @@ GC_m2s (uint16_t m) /** * Confirm the creation of a channel. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: s = "CHAN_ACK"; break; /** * Confirm the creation of a channel. */ - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: s = "CHAN_NACK"; break; diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index c63337c95..c45c4c684 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h @@ -56,12 +56,12 @@ GNUNET_NETWORK_STRUCT_BEGIN /** * Message for cadet connection creation. */ -struct GNUNET_CADET_ConnectionCreate +struct GNUNET_CADET_ConnectionCreateMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE * - * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) + + * Size: sizeof (struct GNUNET_CADET_ConnectionCreateMessage) + * path_length * sizeof (struct GNUNET_PeerIdentity) */ struct GNUNET_MessageHeader header; @@ -87,10 +87,10 @@ struct GNUNET_CADET_ConnectionCreate /** * Message for ack'ing a connection */ -struct GNUNET_CADET_ConnectionACK +struct GNUNET_CADET_ConnectionCreateMessageAckMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK + * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK */ struct GNUNET_MessageHeader header; @@ -110,7 +110,7 @@ struct GNUNET_CADET_ConnectionACK /** * Message for notifying a disconnection in a path */ -struct GNUNET_CADET_ConnectionBroken +struct GNUNET_CADET_ConnectionBrokenMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN @@ -142,7 +142,7 @@ struct GNUNET_CADET_ConnectionBroken /** * Message to destroy a connection. */ -struct GNUNET_CADET_ConnectionDestroy +struct GNUNET_CADET_ConnectionDestroyMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY @@ -164,10 +164,10 @@ struct GNUNET_CADET_ConnectionDestroy /** * Message to acknowledge cadet encrypted traffic. */ -struct GNUNET_CADET_ACK +struct GNUNET_CADET_ConnectionEncryptedAckMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK + * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK */ struct GNUNET_MessageHeader header; @@ -186,10 +186,10 @@ struct GNUNET_CADET_ACK /** * Message to query a peer about its Flow Control status regarding a tunnel. */ -struct GNUNET_CADET_Poll +struct GNUNET_CADET_ConnectionHopByHopPollMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL + * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL */ struct GNUNET_MessageHeader header; @@ -231,10 +231,10 @@ enum GNUNET_CADET_KX_Flags { /** * Message for a Key eXchange for a tunnel. */ -struct GNUNET_CADET_KX +struct GNUNET_CADET_TunnelKeyExchangeMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. + * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX. */ struct GNUNET_MessageHeader header; @@ -268,10 +268,10 @@ struct GNUNET_CADET_KX /** * Axolotl tunnel message. */ -struct GNUNET_CADET_Encrypted +struct GNUNET_CADET_ConnectionEncryptedMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED + * Type: #GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED */ struct GNUNET_MessageHeader header; @@ -327,7 +327,7 @@ struct GNUNET_CADET_Encrypted /** * Message to create a Channel. */ -struct GNUNET_CADET_ChannelCreate +struct GNUNET_CADET_ChannelCreateMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE @@ -355,7 +355,7 @@ struct GNUNET_CADET_ChannelCreate /** * Message to manage a Channel (ACK, NACK, Destroy). */ -struct GNUNET_CADET_ChannelManage +struct GNUNET_CADET_ChannelManageMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY} @@ -374,7 +374,7 @@ struct GNUNET_CADET_ChannelManage /** * Message for cadet data traffic. */ -struct GNUNET_CADET_Data +struct GNUNET_CADET_ChannelDataMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, @@ -401,10 +401,10 @@ struct GNUNET_CADET_Data /** * Message to acknowledge end-to-end data. */ -struct GNUNET_CADET_DataACK +struct GNUNET_CADET_ChannelDataAckMessage { /** - * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK + * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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 c8cd2fc63..64bb25403 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_ChannelCreateMessage *msg; + struct GNUNET_CADET_ChannelCreateMessageMessage *msg; struct GNUNET_CADET_ClientChannelNumber lid; lid = client_get_next_lid (c); @@ -464,7 +464,7 @@ handle_port_close (void *cls, */ static void handle_channel_create (void *cls, - const struct GNUNET_CADET_ChannelCreateMessage *ccm) + const struct GNUNET_CADET_ChannelCreateMessageMessage *ccm) { struct CadetClient *c = cls; struct CadetChannel *ch; @@ -1311,7 +1311,7 @@ GNUNET_SERVICE_MAIN NULL), GNUNET_MQ_hd_fixed_size (channel_create, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - struct GNUNET_CADET_ChannelCreateMessage, + struct GNUNET_CADET_ChannelCreateMessageMessage, 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 00bdf569e..fb6379de5 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -68,7 +68,7 @@ struct ChannelMessageIdentifier /** * Message to create a Channel. */ -struct GNUNET_CADET_ChannelCreate +struct GNUNET_CADET_ChannelCreateMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE @@ -96,7 +96,7 @@ struct GNUNET_CADET_ChannelCreate /** * Message for cadet data traffic. */ -struct GNUNET_CADET_Data +struct GNUNET_CADET_ChannelDataMessage { /** * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, @@ -123,10 +123,10 @@ struct GNUNET_CADET_Data /** * Message to acknowledge end-to-end data. */ -struct GNUNET_CADET_DataACK +struct GNUNET_CADET_ChannelDataAckMessage { /** - * Type: #GNUNET_MESSAGE_TYPE_CADET_DATA_ACK + * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK */ struct GNUNET_MessageHeader header; @@ -219,7 +219,7 @@ struct CadetReliableMessage /** * Data message we are trying to send. */ - struct GNUNET_CADET_Data data_message; + struct GNUNET_CADET_ChannelDataMessage data_message; /* followed by variable-size payload */ }; @@ -266,7 +266,7 @@ 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_ACK). Used to cancel + * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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_ChannelCreate msgcc; + struct GNUNET_CADET_ChannelCreateMessage msgcc; uint32_t options; options = 0; @@ -696,9 +696,9 @@ send_ack_cb (void *cls) static void send_channel_ack (struct CadetChannel *ch) { - struct GNUNET_CADET_DataACK msg; + struct GNUNET_CADET_ChannelDataAckMessage msg; - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_Data) + payload_size); - crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); + 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); 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 ff0579dc2..95342d631 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.c +++ b/src/cadet/gnunet-service-cadet-new_connection.c @@ -190,7 +190,7 @@ GCC_destroy (struct CadetConnection *cc) { /* Need to notify next hop that we are down. */ struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_ConnectionDestroy *destroy_msg; + struct GNUNET_CADET_ConnectionDestroyMessage *destroy_msg; env = GNUNET_MQ_msg (destroy_msg, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY); @@ -253,7 +253,7 @@ GCC_handle_connection_ack (struct CadetConnection *cc) */ void GCC_handle_kx (struct CadetConnection *cc, - const struct GNUNET_CADET_KX *msg) + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { GCT_handle_kx (cc->ct, msg); @@ -268,7 +268,7 @@ GCC_handle_kx (struct CadetConnection *cc, */ void GCC_handle_encrypted (struct CadetConnection *cc, - const struct GNUNET_CADET_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { GCT_handle_encrypted (cc->ct, msg); @@ -314,7 +314,7 @@ static void send_create (void *cls) { struct CadetConnection *cc = cls; - struct GNUNET_CADET_ConnectionCreate *create_msg; + struct GNUNET_CADET_ConnectionCreateMessage *create_msg; struct GNUNET_PeerIdentity *pids; struct GNUNET_MQ_Envelope *env; unsigned int path_length; diff --git a/src/cadet/gnunet-service-cadet-new_connection.h b/src/cadet/gnunet-service-cadet-new_connection.h index 515863aad..440fb9019 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.h +++ b/src/cadet/gnunet-service-cadet-new_connection.h @@ -107,7 +107,7 @@ GCC_handle_connection_ack (struct CadetConnection *cc); */ void GCC_handle_kx (struct CadetConnection *cc, - const struct GNUNET_CADET_KX *msg); + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); /** @@ -118,7 +118,7 @@ GCC_handle_kx (struct CadetConnection *cc, */ void GCC_handle_encrypted (struct CadetConnection *cc, - const struct GNUNET_CADET_Encrypted *msg); + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); /** diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c index 943191a0b..b925200a6 100644 --- a/src/cadet/gnunet-service-cadet-new_core.c +++ b/src/cadet/gnunet-service-cadet-new_core.c @@ -113,7 +113,7 @@ route_message (struct CadetPeer *prev, if (NULL == route) { struct GNUNET_MQ_Envelope *env; - struct GNUNET_CADET_ConnectionBroken *bm; + struct GNUNET_CADET_ConnectionBrokenMessage *bm; env = GNUNET_MQ_msg (bm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); @@ -138,7 +138,7 @@ route_message (struct CadetPeer *prev, */ static int check_create (void *cls, - const struct GNUNET_CADET_ConnectionCreate *msg) + const struct GNUNET_CADET_ConnectionCreateMessage *msg) { uint16_t size = ntohs (msg->header.size) - sizeof (*msg); @@ -171,7 +171,7 @@ destroy_route (struct CadetRoute *route) */ static void handle_create (void *cls, - const struct GNUNET_CADET_ConnectionCreate *msg) + const struct GNUNET_CADET_ConnectionCreateMessage *msg) { struct CadetPeer *peer = cls; uint16_t size = ntohs (msg->header.size) - sizeof (*msg); @@ -188,14 +188,14 @@ handle_create (void *cls, /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void handle_connection_ack (void *cls, - const struct GNUNET_CADET_ConnectionACK *msg) + const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -236,7 +236,7 @@ handle_connection_ack (void *cls, */ static void handle_broken (void *cls, - const struct GNUNET_CADET_ConnectionBroken *msg) + const struct GNUNET_CADET_ConnectionBrokenMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -282,7 +282,7 @@ handle_broken (void *cls, */ static void handle_destroy (void *cls, - const struct GNUNET_CADET_ConnectionDestroy *msg) + const struct GNUNET_CADET_ConnectionDestroyMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -318,14 +318,14 @@ handle_destroy (void *cls, /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_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_ACK *msg) + const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) { struct CadetPeer *peer = cls; @@ -337,14 +337,14 @@ handle_ack (void *cls, /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_POLL + * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void handle_poll (void *cls, - const struct GNUNET_CADET_Poll *msg) + const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) { struct CadetPeer *peer = cls; @@ -356,14 +356,14 @@ handle_poll (void *cls, /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_KX + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void handle_kx (void *cls, - const struct GNUNET_CADET_KX *msg) + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -406,21 +406,21 @@ handle_kx (void *cls, */ static int check_encrypted (void *cls, - const struct GNUNET_CADET_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { return GNUNET_YES; } /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED. + * Handle for #GNUNET_MESSAGE_TYPE_CONNECTION_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_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { struct CadetPeer *peer = cls; struct CadetConnection *cc; @@ -534,35 +534,35 @@ GCO_init (const struct GNUNET_CONFIGURATION_Handle *c) struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, - struct GNUNET_CADET_ConnectionCreate, + struct GNUNET_CADET_ConnectionCreateMessage, NULL), GNUNET_MQ_hd_fixed_size (connection_ack, - GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, - struct GNUNET_CADET_ConnectionACK, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, + struct GNUNET_CADET_ConnectionCreateMessageAckMessage, NULL), GNUNET_MQ_hd_fixed_size (broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, - struct GNUNET_CADET_ConnectionBroken, + struct GNUNET_CADET_ConnectionBrokenMessage, NULL), GNUNET_MQ_hd_fixed_size (destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, - struct GNUNET_CADET_ConnectionDestroy, + struct GNUNET_CADET_ConnectionDestroyMessage, NULL), GNUNET_MQ_hd_fixed_size (ack, - GNUNET_MESSAGE_TYPE_CADET_ACK, - struct GNUNET_CADET_ACK, + GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK, + struct GNUNET_CADET_ConnectionEncryptedAckMessage, NULL), GNUNET_MQ_hd_fixed_size (poll, - GNUNET_MESSAGE_TYPE_CADET_POLL, - struct GNUNET_CADET_Poll, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL, + struct GNUNET_CADET_ConnectionHopByHopPollMessage, NULL), GNUNET_MQ_hd_fixed_size (kx, - GNUNET_MESSAGE_TYPE_CADET_KX, - struct GNUNET_CADET_KX, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, + struct GNUNET_CADET_TunnelKeyExchangeMessage, NULL), GNUNET_MQ_hd_var_size (encrypted, - GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, - struct GNUNET_CADET_Encrypted, + GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED, + struct GNUNET_CADET_ConnectionEncryptedMessage, 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 74e56aa35..2425a4503 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_Encrypted *msg) + struct GNUNET_CADET_ConnectionEncryptedMessage *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_Encrypted *src, - struct GNUNET_CADET_Encrypted *dst) + const struct GNUNET_CADET_ConnectionEncryptedMessage *src, + struct GNUNET_CADET_ConnectionEncryptedMessage *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_Encrypted *src, + const struct GNUNET_CADET_ConnectionEncryptedMessage *src, size_t size) { struct CadetTunnelSkippedKey *key; struct GNUNET_ShortHashCode *hmac; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; - struct GNUNET_CADET_Encrypted plaintext_header; + struct GNUNET_CADET_ConnectionEncryptedMessage 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_Encrypted); + esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); /* 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_Encrypted)); - len = size - sizeof (struct GNUNET_CADET_Encrypted); + GNUNET_assert (size > sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage)); + len = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); 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_Encrypted *src, + const struct GNUNET_CADET_ConnectionEncryptedMessage *src, size_t size) { struct CadetTunnelAxolotl *ax; struct GNUNET_ShortHashCode msg_hmac; struct GNUNET_HashCode hmac; - struct GNUNET_CADET_Encrypted plaintext_header; + struct GNUNET_CADET_ConnectionEncryptedMessage plaintext_header; uint32_t Np; uint32_t PNp; size_t esize; /* Size of encryped payload */ - esize = size - sizeof (struct GNUNET_CADET_Encrypted); + esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); 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_Data *msg) + const struct GNUNET_CADET_ChannelDataMessage *msg) { return GNUNET_OK; } @@ -1425,7 +1425,7 @@ check_plaintext_data (void *cls, */ static void handle_plaintext_data (void *cls, - const struct GNUNET_CADET_Data *msg) + const struct GNUNET_CADET_ChannelDataMessage *msg) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1440,7 +1440,7 @@ handle_plaintext_data (void *cls, */ static void handle_plaintext_data_ack (void *cls, - const struct GNUNET_CADET_DataACK *ack) + const struct GNUNET_CADET_ChannelDataAckMessage *ack) { 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_ChannelCreate *cc) + const struct GNUNET_CADET_ChannelCreateMessage *cc) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1470,7 +1470,7 @@ handle_plaintext_channel_create (void *cls, */ static void handle_plaintext_channel_nack (void *cls, - const struct GNUNET_CADET_ChannelManage *cm) + const struct GNUNET_CADET_ChannelManageMessage *cm) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1485,7 +1485,7 @@ handle_plaintext_channel_nack (void *cls, */ static void handle_plaintext_channel_ack (void *cls, - const struct GNUNET_CADET_ChannelManage *cm) + const struct GNUNET_CADET_ChannelManageMessage *cm) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1500,7 +1500,7 @@ handle_plaintext_channel_ack (void *cls, */ static void handle_plaintext_channel_destroy (void *cls, - const struct GNUNET_CADET_ChannelManage *cm) + const struct GNUNET_CADET_ChannelManageMessage *cm) { struct CadetTunnel *t = cls; GNUNET_break (0); // FIXME! @@ -1554,32 +1554,32 @@ GCT_create_tunnel (struct CadetPeer *destination) { struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_fixed_size (plaintext_keepalive, - GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_var_size (plaintext_data, - GNUNET_MESSAGE_TYPE_CADET_DATA, - struct GNUNET_CADET_Data, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA, + struct GNUNET_CADET_ChannelDataMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_data_ack, - GNUNET_MESSAGE_TYPE_CADET_DATA_ACK, - struct GNUNET_CADET_DataACK, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK, + struct GNUNET_CADET_ChannelDataAckMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_create, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, - struct GNUNET_CADET_ChannelCreate, + struct GNUNET_CADET_ChannelCreateMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_nack, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK, - struct GNUNET_CADET_ChannelManage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED, + struct GNUNET_CADET_ChannelManageMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_ack, - GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK, - struct GNUNET_CADET_ChannelManage, + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK, + struct GNUNET_CADET_ChannelManageMessage, NULL), GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, - struct GNUNET_CADET_ChannelManage, + struct GNUNET_CADET_ChannelManageMessage, NULL), GNUNET_MQ_handler_end () }; @@ -1678,7 +1678,7 @@ GCT_change_estate (struct CadetTunnel *t, */ void GCT_handle_kx (struct CadetTConnection *ct, - const struct GNUNET_CADET_KX *msg) + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { GNUNET_break (0); // not implemented } @@ -1692,7 +1692,7 @@ GCT_handle_kx (struct CadetTConnection *ct, */ void GCT_handle_encrypted (struct CadetTConnection *ct, - const struct GNUNET_CADET_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *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_Encrypted *ax_msg; + struct GNUNET_CADET_ConnectionEncryptedMessage *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_CADET_ENCRYPTED); + GNUNET_MESSAGE_TYPE_CONNECTION_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 c0e179771..d565077b0 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.h +++ b/src/cadet/gnunet-service-cadet-new_tunnels.h @@ -325,7 +325,7 @@ GCT_get_estate (struct CadetTunnel *t); */ void GCT_handle_kx (struct CadetTConnection *ct, - const struct GNUNET_CADET_KX *msg); + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); /** @@ -336,7 +336,7 @@ GCT_handle_kx (struct CadetTConnection *ct, */ void GCT_handle_encrypted (struct CadetTConnection *ct, - const struct GNUNET_CADET_Encrypted *msg); + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); /** diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 6bc3dc590..eff6af40b 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_Data with payload */ + /* struct GNUNET_CADET_ChannelDataMessage 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_Data *msg, uint32_t mid, +copy_message (const struct GNUNET_CADET_ChannelDataMessage *msg, uint32_t mid, struct CadetChannelReliability *rel) { struct CadetReliableMessage *copy; @@ -378,7 +378,7 @@ copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, copy = GNUNET_malloc (sizeof (*copy) + size); copy->mid = mid; copy->rel = rel; - copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA; + copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA; GNUNET_memcpy (©[1], msg, size); return copy; @@ -393,7 +393,7 @@ copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, * @param rel Reliability data to the corresponding direction. */ static void -add_buffered_data (const struct GNUNET_CADET_Data *msg, +add_buffered_data (const struct GNUNET_CADET_ChannelDataMessage *msg, struct CadetChannelReliability *rel) { struct CadetReliableMessage *copy; @@ -513,7 +513,7 @@ channel_get_options (struct CadetChannel *ch) static void send_destroy (struct CadetChannel *ch, int local_only) { - struct GNUNET_CADET_ChannelManage msg; + struct GNUNET_CADET_ChannelManageMessage msg; msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); msg.header.size = htons (sizeof (msg)); @@ -573,7 +573,7 @@ send_client_create (struct CadetChannel *ch) */ static void send_client_data (struct CadetChannel *ch, - const struct GNUNET_CADET_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *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_Data *msg = (struct GNUNET_CADET_Data *) ©[1]; + struct GNUNET_CADET_ChannelDataMessage *msg = (struct GNUNET_CADET_ChannelDataMessage *) ©[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_Data *payload; + struct GNUNET_CADET_ChannelDataMessage *payload; int fwd; rel->retry_task = NULL; @@ -743,7 +743,7 @@ channel_retransmit_message (void *cls) return; } - payload = (struct GNUNET_CADET_Data *) ©[1]; + payload = (struct GNUNET_CADET_ChannelDataMessage *) ©[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_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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_DATA_ACK != type + && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK != type && GNUNET_NO == rel->ch->destroy) { GNUNET_assert (NULL == rel->retry_task); @@ -882,7 +882,7 @@ ch_message_sent (void *cls, static void send_create (struct CadetChannel *ch) { - struct GNUNET_CADET_ChannelCreate msgcc; + struct GNUNET_CADET_ChannelCreateMessage msgcc; msgcc.header.size = htons (sizeof (msgcc)); msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); @@ -903,10 +903,10 @@ send_create (struct CadetChannel *ch) static void send_ack (struct CadetChannel *ch, int fwd) { - struct GNUNET_CADET_ChannelManage msg; + struct GNUNET_CADET_ChannelManageMessage msg; msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", GC_f2s (fwd), GCCH_2s (ch)); @@ -943,10 +943,10 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg, static void send_nack (struct CadetChannel *ch) { - struct GNUNET_CADET_ChannelManage msg; + struct GNUNET_CADET_ChannelManageMessage msg; msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel NACK for channel %s\n", GCCH_2s (ch)); @@ -1024,7 +1024,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel) */ static unsigned int channel_rel_free_sent (struct CadetChannelReliability *rel, - const struct GNUNET_CADET_DataACK *msg) + const struct GNUNET_CADET_ChannelDataAckMessage *msg) { struct CadetReliableMessage *copy; struct CadetReliableMessage *next; @@ -1300,35 +1300,35 @@ handle_loopback (struct CadetChannel *ch, switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_Data *) msgh)->mid), ntohs (msgh->size)); - GCCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); + ntohl (((struct GNUNET_CADET_ChannelDataMessage *) msgh)->mid), ntohs (msgh->size)); + GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelDataMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: - GCCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + GCCH_handle_data_ack (ch, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: GCCH_handle_create (ch->t, - (struct GNUNET_CADET_ChannelCreate *) msgh); + (struct GNUNET_CADET_ChannelCreateMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: GCCH_handle_ack (ch, - (struct GNUNET_CADET_ChannelManage *) msgh, + (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: GCCH_handle_nack (ch); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: GCCH_handle_destroy (ch, - (struct GNUNET_CADET_ChannelManage *) msgh, + (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; @@ -1523,7 +1523,7 @@ GCCH_is_terminal (struct CadetChannel *ch, int fwd) void GCCH_send_data_ack (struct CadetChannel *ch, int fwd) { - struct GNUNET_CADET_DataACK msg; + struct GNUNET_CADET_ChannelDataAckMessage msg; struct CadetChannelReliability *rel; struct CadetReliableMessage *copy; unsigned int delta; @@ -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_DATA_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_DATA) + if (copy->type != GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_Data *payload; - uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size; + struct GNUNET_CADET_ChannelDataMessage *payload; + uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelDataMessage) + 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_Data *) cbuf; + payload = (struct GNUNET_CADET_ChannelDataMessage *) 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_DATA); + payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_ChannelCreateMessage *msg) + struct GNUNET_CADET_ChannelCreateMessageMessage *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_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *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_DATA), GC_m2s (payload_type), mid, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA), GC_m2s (payload_type), mid, GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); if ( (GNUNET_NO == ch->reliable) || @@ -2044,7 +2044,7 @@ GCCH_handle_data (struct CadetChannel *ch, */ void GCCH_handle_data_ack (struct CadetChannel *ch, - const struct GNUNET_CADET_DataACK *msg, + const struct GNUNET_CADET_ChannelDataAckMessage *msg, int fwd) { struct CadetChannelReliability *rel; @@ -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_DATA_ACK), msg->futures, ack, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_ChannelCreate *msg) + const struct GNUNET_CADET_ChannelCreateMessage *msg) { struct GNUNET_CADET_ClientChannelNumber chid; struct GNUNET_CADET_ChannelNumber gid; @@ -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_NACK), ch->gid, 0, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED), ch->gid, 0, GCCH_2s (ch), ch, "---", 0); send_client_nack (ch); @@ -2272,12 +2272,12 @@ GCCH_handle_nack (struct CadetChannel *ch) */ void GCCH_handle_ack (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd) { LOG (GNUNET_ERROR_TYPE_INFO, "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", - GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK), ch->gid, 0, + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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'. */ @@ -2308,7 +2308,7 @@ GCCH_handle_ack (struct CadetChannel *ch, */ void GCCH_handle_destroy (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd) { struct CadetChannelReliability *rel; @@ -2383,13 +2383,13 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, data_id = 0; switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: { - struct GNUNET_CADET_Data *data_msg; + struct GNUNET_CADET_ChannelDataMessage *data_msg; struct GNUNET_MessageHeader *payload_msg; uint16_t payload_type; - data_msg = (struct GNUNET_CADET_Data *) message; + data_msg = (struct GNUNET_CADET_ChannelDataMessage *) message; data_id = ntohl (data_msg->mid); payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1]; payload_type = ntohs (payload_msg->type); @@ -2397,10 +2397,10 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, info[31] = '\0'; break; } - case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: { - struct GNUNET_CADET_DataACK *ack_msg; - ack_msg = (struct GNUNET_CADET_DataACK *) message; + struct GNUNET_CADET_ChannelDataAckMessage *ack_msg; + ack_msg = (struct GNUNET_CADET_ChannelDataAckMessage *) message; data_id = ntohl (ack_msg->mid); SPRINTF (info, "0x%010lX", (unsigned long int) ack_msg->futures); @@ -2408,17 +2408,17 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, } case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: { - struct GNUNET_CADET_ChannelCreate *cc_msg; - cc_msg = (struct GNUNET_CADET_ChannelCreate *) message; + struct GNUNET_CADET_ChannelCreateMessage *cc_msg; + cc_msg = (struct GNUNET_CADET_ChannelCreateMessage *) message; SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid.cn)); break; } - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: { - struct GNUNET_CADET_ChannelManage *m_msg; - m_msg = (struct GNUNET_CADET_ChannelManage *) message; + struct GNUNET_CADET_ChannelManageMessage *m_msg; + m_msg = (struct GNUNET_CADET_ChannelManageMessage *) message; SPRINTF (info, " 0x%08X", ntohl (m_msg->chid.cn)); break; } @@ -2438,7 +2438,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_DATA_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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_NACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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 8faad2e86..c6a1df9ff 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_ChannelCreateMessage *msg); + struct GNUNET_CADET_ChannelCreateMessageMessage *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_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *msg, int fwd); @@ -254,7 +254,7 @@ GCCH_handle_data (struct CadetChannel *ch, */ void GCCH_handle_data_ack (struct CadetChannel *ch, - const struct GNUNET_CADET_DataACK *msg, + const struct GNUNET_CADET_ChannelDataAckMessage *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_ChannelCreate *msg); + const struct GNUNET_CADET_ChannelCreateMessage *msg); /** @@ -294,7 +294,7 @@ GCCH_handle_nack (struct CadetChannel *ch); */ void GCCH_handle_ack (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd); @@ -310,7 +310,7 @@ GCCH_handle_ack (struct CadetChannel *ch, */ void GCCH_handle_destroy (struct CadetChannel *ch, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd); diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 500511ce4..351bf2d3c 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -549,7 +549,7 @@ send_ack (struct CadetConnection *c, { struct CadetFlowControl *next_fc; struct CadetFlowControl *prev_fc; - struct GNUNET_CADET_ACK msg; + struct GNUNET_CADET_ConnectionEncryptedAckMessage msg; uint32_t ack; int delta; @@ -609,7 +609,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_ACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK); msg.ack = htonl (ack); msg.cid = c->id; @@ -730,7 +730,7 @@ conn_message_sent (void *cls, } else /* CONN_CREATE or CONN_ACK */ { - GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED != type); + GNUNET_assert (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED != type); forced = GNUNET_YES; } @@ -750,14 +750,14 @@ conn_message_sent (void *cls, switch (type) { case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: c->maintenance_q = NULL; /* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */ if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE == type || !fwd) schedule_next_keepalive (c, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: if (GNUNET_YES == sent) { fc->last_pid_sent = pid; @@ -783,12 +783,12 @@ conn_message_sent (void *cls, } break; - case GNUNET_MESSAGE_TYPE_CADET_KX: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: if (GNUNET_YES == sent) connection_reset_timeout (c, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_POLL: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL: fc->poll_msg = NULL; if (2 == c->destroy) { @@ -809,7 +809,7 @@ conn_message_sent (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, " task %u\n", fc->poll_task); break; - case GNUNET_MESSAGE_TYPE_CADET_ACK: + case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK: fc->ack_msg = NULL; break; @@ -1029,10 +1029,10 @@ is_fwd (const struct CadetConnection *c, static void send_connection_ack (struct CadetConnection *c, int fwd) { - struct GNUNET_CADET_ConnectionACK msg; + struct GNUNET_CADET_ConnectionCreateMessageAckMessage msg; struct CadetTunnel *t; - const uint16_t size = sizeof (struct GNUNET_CADET_ConnectionACK); - const uint16_t type = GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK; + const uint16_t size = sizeof (struct GNUNET_CADET_ConnectionCreateMessageAckMessage); + const uint16_t type = GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK; GCC_check_connections (); t = c->t; @@ -1047,7 +1047,7 @@ send_connection_ack (struct CadetConnection *c, int fwd) GNUNET_assert (NULL == c->maintenance_q); c->maintenance_q = GCP_send (get_hop (c, fwd), &msg.header, - GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, 0, c, fwd, &conn_message_sent, NULL); LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (conn`ACK)\n", @@ -1076,10 +1076,10 @@ send_broken (struct CadetConnection *c, const struct GNUNET_PeerIdentity *id2, int fwd) { - struct GNUNET_CADET_ConnectionBroken msg; + struct GNUNET_CADET_ConnectionBrokenMessage msg; GCC_check_connections (); - msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); + msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBrokenMessage)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); msg.cid = c->id; msg.reserved = htonl (0); @@ -1106,13 +1106,13 @@ send_broken_unknown (const struct GNUNET_CADET_ConnectionTunnelIdentifier *conne const struct GNUNET_PeerIdentity *id2, struct CadetPeer *neighbor) { - struct GNUNET_CADET_ConnectionBroken msg; + struct GNUNET_CADET_ConnectionBrokenMessage msg; GCC_check_connections (); LOG (GNUNET_ERROR_TYPE_INFO, "--> BROKEN on unknown connection %s\n", GNUNET_sh2s (&connection_id->connection_of_tunnel)); - msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); + msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBrokenMessage)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); msg.cid = *connection_id; msg.reserved = htonl (0); @@ -1161,7 +1161,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd) GNUNET_assert (NULL != c->t); msg.size = htons (sizeof (msg)); - msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE); + msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE); GNUNET_assert (NULL == GCT_send_prebuilt_message (&msg, c->t, c, @@ -1419,7 +1419,7 @@ static void send_poll (void *cls) { struct CadetFlowControl *fc = cls; - struct GNUNET_CADET_Poll msg; + struct GNUNET_CADET_ConnectionHopByHopPollMessage msg; struct CadetConnection *c; int fwd; @@ -1430,7 +1430,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_POLL); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL); msg.header.size = htons (sizeof (msg)); msg.cid = c->id; msg.pid = htonl (fc->last_pid_sent); @@ -1848,7 +1848,7 @@ log_message (const struct GNUNET_MessageHeader *message, switch (type) { case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: arrow = "=="; @@ -1877,7 +1877,7 @@ log_message (const struct GNUNET_MessageHeader *message, */ void GCC_handle_create (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionCreate *msg) + const struct GNUNET_CADET_ConnectionCreateMessage *msg) { const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid; struct GNUNET_PeerIdentity *id; @@ -1892,7 +1892,7 @@ GCC_handle_create (struct CadetPeer *peer, size = ntohs (msg->header.size); /* Calculate hops */ - size -= sizeof (struct GNUNET_CADET_ConnectionCreate); + size -= sizeof (struct GNUNET_CADET_ConnectionCreateMessage); if (0 != size % sizeof (struct GNUNET_PeerIdentity)) { GNUNET_break_op (0); @@ -2017,7 +2017,7 @@ GCC_handle_create (struct CadetPeer *peer, */ void GCC_handle_confirm (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionACK *msg) + const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) { struct CadetConnection *c; enum CadetConnectionState oldstate; @@ -2141,7 +2141,7 @@ GCC_handle_confirm (struct CadetPeer *peer, */ void GCC_handle_broken (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionBroken *msg) + const struct GNUNET_CADET_ConnectionBrokenMessage *msg) { struct CadetConnection *c; struct CadetTunnel *t; @@ -2212,7 +2212,7 @@ GCC_handle_broken (struct CadetPeer *peer, */ void GCC_handle_destroy (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionDestroy *msg) + const struct GNUNET_CADET_ConnectionDestroyMessage *msg) { struct CadetConnection *c; int fwd; @@ -2274,7 +2274,7 @@ GCC_handle_destroy (struct CadetPeer *peer, */ void GCC_handle_ack (struct CadetPeer *peer, - const struct GNUNET_CADET_ACK *msg) + const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) { struct CadetConnection *c; struct CadetFlowControl *fc; @@ -2343,7 +2343,7 @@ GCC_handle_ack (struct CadetPeer *peer, */ void GCC_handle_poll (struct CadetPeer *peer, - const struct GNUNET_CADET_Poll *msg) + const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) { struct CadetConnection *c; struct CadetFlowControl *fc; @@ -2466,7 +2466,7 @@ check_message (const struct GNUNET_MessageHeader *message, /* Check PID for payload messages */ type = ntohs (message->type); - if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type) + if (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED == type) { fc = fwd ? &c->bck_fc : &c->fwd_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected in interval [%u,%u])\n", @@ -2537,7 +2537,7 @@ check_message (const struct GNUNET_MessageHeader *message, */ void GCC_handle_kx (struct CadetPeer *peer, - const struct GNUNET_CADET_KX *msg) + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid; struct CadetConnection *c; @@ -2594,7 +2594,7 @@ GCC_handle_kx (struct CadetPeer *peer, */ void GCC_handle_encrypted (struct CadetPeer *peer, - const struct GNUNET_CADET_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid; struct CadetConnection *c; @@ -3227,7 +3227,7 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, GC_f2s(fwd), size); switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: + case GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED: LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u, PIDsnt: %u, ACKrcv: %u\n", fc, fc->queue_n, fc->last_pid_sent, fc->last_ack_recv); if (GNUNET_NO == force) @@ -3236,18 +3236,18 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, } break; - case GNUNET_MESSAGE_TYPE_CADET_KX: + case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: /* nothing to do here */ break; case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: - case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: /* Should've only be used for restransmissions. */ GNUNET_break (0 == payload_type); break; - case GNUNET_MESSAGE_TYPE_CADET_ACK: - case GNUNET_MESSAGE_TYPE_CADET_POLL: + 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_DESTROY: case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: GNUNET_assert (GNUNET_YES == force); @@ -3265,7 +3265,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_CADET_ENCRYPTED == type) + if (GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED == type) { fc->queue_n--; } @@ -3331,15 +3331,15 @@ GCC_send_create (struct CadetConnection *c) size_t size; GCC_check_connections (); - size = sizeof (struct GNUNET_CADET_ConnectionCreate); + size = sizeof (struct GNUNET_CADET_ConnectionCreateMessage); size += c->path->length * sizeof (struct GNUNET_PeerIdentity); { /* Allocate message on the stack */ unsigned char cbuf[size]; - struct GNUNET_CADET_ConnectionCreate *msg; + struct GNUNET_CADET_ConnectionCreateMessage *msg; struct GNUNET_PeerIdentity *peers; - msg = (struct GNUNET_CADET_ConnectionCreate *) cbuf; + msg = (struct GNUNET_CADET_ConnectionCreateMessage *) cbuf; msg->header.size = htons (size); msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); msg->reserved = htonl (0); @@ -3449,7 +3449,7 @@ GCC_send_ack (struct CadetConnection *c, int fwd, int force) void GCC_send_destroy (struct CadetConnection *c) { - struct GNUNET_CADET_ConnectionDestroy msg; + struct GNUNET_CADET_ConnectionDestroyMessage msg; if (GNUNET_YES == c->destroy) return; diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index 3d3e8adbe..6df307dd1 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h @@ -125,7 +125,7 @@ typedef void */ void GCC_handle_create (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionCreate *msg); + const struct GNUNET_CADET_ConnectionCreateMessage *msg); /** @@ -136,7 +136,7 @@ GCC_handle_create (struct CadetPeer *peer, */ void GCC_handle_confirm (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionACK *msg); + const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg); /** @@ -147,7 +147,7 @@ GCC_handle_confirm (struct CadetPeer *peer, */ void GCC_handle_broken (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionBroken *msg); + const struct GNUNET_CADET_ConnectionBrokenMessage *msg); /** * Handler for notifications of destroyed connections. @@ -157,7 +157,7 @@ GCC_handle_broken (struct CadetPeer *peer, */ void GCC_handle_destroy (struct CadetPeer *peer, - const struct GNUNET_CADET_ConnectionDestroy *msg); + const struct GNUNET_CADET_ConnectionDestroyMessage *msg); /** * Handler for cadet network traffic hop-by-hop acks. @@ -167,7 +167,7 @@ GCC_handle_destroy (struct CadetPeer *peer, */ void GCC_handle_ack (struct CadetPeer *peer, - const struct GNUNET_CADET_ACK *msg); + const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg); /** * Handler for cadet network traffic hop-by-hop data counter polls. @@ -177,7 +177,7 @@ GCC_handle_ack (struct CadetPeer *peer, */ void GCC_handle_poll (struct CadetPeer *peer, - const struct GNUNET_CADET_Poll *msg); + const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg); /** * Handler for key exchange traffic (Axolotl KX). @@ -187,7 +187,7 @@ GCC_handle_poll (struct CadetPeer *peer, */ void GCC_handle_kx (struct CadetPeer *peer, - const struct GNUNET_CADET_KX *msg); + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); /** * Handler for encrypted cadet network traffic (channel mgmt, data). @@ -197,7 +197,7 @@ GCC_handle_kx (struct CadetPeer *peer, */ void GCC_handle_encrypted (struct CadetPeer *peer, - const struct GNUNET_CADET_Encrypted *msg); + const struct GNUNET_CADET_ConnectionEncryptedMessage *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 cea28bcd2..40d7e26dc 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_ChannelCreateMessage) + if (sizeof (struct GNUNET_CADET_ChannelCreateMessageMessage) != 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_ChannelCreateMessage *) + (struct GNUNET_CADET_ChannelCreateMessageMessage *) message)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -1129,7 +1129,7 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { {&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_ChannelCreateMessage)}, + sizeof (struct GNUNET_CADET_ChannelCreateMessageMessage)}, {&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,7 +1434,7 @@ GML_send_channel_create (struct CadetClient *c, uint32_t opt, const struct GNUNET_PeerIdentity *peer) { - struct GNUNET_CADET_ChannelCreateMessage msg; + struct GNUNET_CADET_ChannelCreateMessageMessage msg; msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); @@ -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_NACK); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_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_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *msg, struct GNUNET_CADET_ClientChannelNumber id) { struct GNUNET_CADET_LocalData *copy; - uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_Data); + uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_ChannelDataMessage); 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 9b6e5bf05..9428cd4b9 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_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *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 a3defb87e..2c2c552c6 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -456,7 +456,7 @@ core_disconnect_handler (void *cls, * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. */ static int -check_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) +check_create (void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg) { uint16_t size; @@ -476,7 +476,7 @@ check_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) * @param msg Message itself. */ static void -handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) +handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_create (peer, msg); @@ -484,13 +484,13 @@ handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionACK *msg) +handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_confirm (peer, msg); @@ -504,7 +504,7 @@ handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionACK *msg) * @param msg Message itself. */ static void -handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBroken *msg) +handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBrokenMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_broken (peer, msg); @@ -518,7 +518,7 @@ handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBroken *msg) * @param msg Message itself. */ static void -handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroy *msg) +handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroyMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_destroy (peer, msg); @@ -526,13 +526,13 @@ handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroy *msg) /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ACK + * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_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_ACK *msg) +handle_ack (void *cls, const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_ack (peer, msg); @@ -540,13 +540,13 @@ handle_ack (void *cls, const struct GNUNET_CADET_ACK *msg) /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_POLL + * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_poll (void *cls, const struct GNUNET_CADET_Poll *msg) +handle_poll (void *cls, const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_poll (peer, msg); @@ -554,13 +554,13 @@ handle_poll (void *cls, const struct GNUNET_CADET_Poll *msg) /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_KX + * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX * * @param cls Closure (CadetPeer for neighbor that sent the message). * @param msg Message itself. */ static void -handle_kx (void *cls, const struct GNUNET_CADET_KX *msg) +handle_kx (void *cls, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_kx (peer, msg); @@ -576,13 +576,13 @@ handle_kx (void *cls, const struct GNUNET_CADET_KX *msg) * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. */ static int -check_encrypted (void *cls, const struct GNUNET_CADET_Encrypted *msg) +check_encrypted (void *cls, const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { uint16_t size; uint16_t minimum_size; size = ntohs (msg->header.size); - minimum_size = sizeof (struct GNUNET_CADET_Encrypted) + minimum_size = sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + sizeof (struct GNUNET_MessageHeader); if (size < minimum_size) @@ -594,13 +594,13 @@ check_encrypted (void *cls, const struct GNUNET_CADET_Encrypted *msg) } /** - * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED. + * Handle for #GNUNET_MESSAGE_TYPE_CONNECTION_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_Encrypted *msg) +handle_encrypted (void *cls, const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { struct CadetPeer *peer = cls; GCC_handle_encrypted (peer, msg); @@ -624,35 +624,35 @@ connect_to_core (const struct GNUNET_CONFIGURATION_Handle *c) struct GNUNET_MQ_MessageHandler core_handlers[] = { GNUNET_MQ_hd_var_size (create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, - struct GNUNET_CADET_ConnectionCreate, + struct GNUNET_CADET_ConnectionCreateMessage, NULL), GNUNET_MQ_hd_fixed_size (confirm, - GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, - struct GNUNET_CADET_ConnectionACK, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, + struct GNUNET_CADET_ConnectionCreateMessageAckMessage, NULL), GNUNET_MQ_hd_fixed_size (broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, - struct GNUNET_CADET_ConnectionBroken, + struct GNUNET_CADET_ConnectionBrokenMessage, NULL), GNUNET_MQ_hd_fixed_size (destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, - struct GNUNET_CADET_ConnectionDestroy, + struct GNUNET_CADET_ConnectionDestroyMessage, NULL), GNUNET_MQ_hd_fixed_size (ack, - GNUNET_MESSAGE_TYPE_CADET_ACK, - struct GNUNET_CADET_ACK, + GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK, + struct GNUNET_CADET_ConnectionEncryptedAckMessage, NULL), GNUNET_MQ_hd_fixed_size (poll, - GNUNET_MESSAGE_TYPE_CADET_POLL, - struct GNUNET_CADET_Poll, + GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL, + struct GNUNET_CADET_ConnectionHopByHopPollMessage, NULL), GNUNET_MQ_hd_fixed_size (kx, - GNUNET_MESSAGE_TYPE_CADET_KX, - struct GNUNET_CADET_KX, + GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, + struct GNUNET_CADET_TunnelKeyExchangeMessage, NULL), GNUNET_MQ_hd_var_size (encrypted, - GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, - struct GNUNET_CADET_Encrypted, + GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED, + struct GNUNET_CADET_ConnectionEncryptedMessage, 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_CADET_ENCRYPTED == q->type) + if (GNUNET_MESSAGE_TYPE_CONNECTION_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_ACK || - type == GNUNET_MESSAGE_TYPE_CADET_POLL; + return type == GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK || + type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL; } diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 09e91386e..df1cfa16e 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_Encrypted *msg) +t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -874,8 +874,8 @@ t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_Encrypted *msg) * @param dst Where to decrypt header to. */ static void -t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_Encrypted *src, - struct GNUNET_CADET_Encrypted *dst) +t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_ConnectionEncryptedMessage *src, + struct GNUNET_CADET_ConnectionEncryptedMessage *dst) { struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct CadetTunnelAxolotl *ax; @@ -913,12 +913,12 @@ t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_Encrypted *src, */ static int try_old_ax_keys (struct CadetTunnel *t, void *dst, - const struct GNUNET_CADET_Encrypted *src, size_t size) + const struct GNUNET_CADET_ConnectionEncryptedMessage *src, size_t size) { struct CadetTunnelSkippedKey *key; struct GNUNET_ShortHashCode *hmac; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; - struct GNUNET_CADET_Encrypted plaintext_header; + struct GNUNET_CADET_ConnectionEncryptedMessage 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_Encrypted); + esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); /* 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_Encrypted)); - len = size - sizeof (struct GNUNET_CADET_Encrypted); + GNUNET_assert (size > sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage)); + len = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); 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_Encrypted *src, + const struct GNUNET_CADET_ConnectionEncryptedMessage *src, size_t size) { struct CadetTunnelAxolotl *ax; struct GNUNET_ShortHashCode msg_hmac; struct GNUNET_HashCode hmac; - struct GNUNET_CADET_Encrypted plaintext_header; + struct GNUNET_CADET_ConnectionEncryptedMessage 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_Encrypted); + esize = size - sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); 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_Encrypted *ax_msg; + struct GNUNET_CADET_ConnectionEncryptedMessage *ax_msg; struct CadetTunnelQueue *tq; size_t size = ntohs (message->size); - char cbuf[sizeof (struct GNUNET_CADET_Encrypted) + size] GNUNET_ALIGN; + char cbuf[sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + size] GNUNET_ALIGN; size_t esize; uint32_t mid; uint16_t type; @@ -1353,10 +1353,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); - ax_msg = (struct GNUNET_CADET_Encrypted *) cbuf; + ax_msg = (struct GNUNET_CADET_ConnectionEncryptedMessage *) cbuf; msg = &ax_msg->header; - msg->size = htons (sizeof (struct GNUNET_CADET_Encrypted) + size); - msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED); + msg->size = htons (sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + size); + msg->type = htons (GNUNET_MESSAGE_TYPE_CONNECTION_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); @@ -1385,18 +1385,18 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, type = ntohs (message->type); switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_DATA: - case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: - if (GNUNET_MESSAGE_TYPE_CADET_DATA == type) - mid = ntohl (((struct GNUNET_CADET_Data *) message)->mid); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK: + if (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA == type) + mid = ntohl (((struct GNUNET_CADET_ChannelDataMessage *) message)->mid); else - mid = ntohl (((struct GNUNET_CADET_DataACK *) message)->mid); + mid = ntohl (((struct GNUNET_CADET_ChannelDataAckMessage *) message)->mid); /* Fall thru */ - case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: break; default: GNUNET_break (0); @@ -1570,7 +1570,7 @@ static void send_channel_destroy (struct CadetTunnel *t, struct GNUNET_CADET_ChannelNumber gid) { - struct GNUNET_CADET_ChannelManage msg; + struct GNUNET_CADET_ChannelManageMessage msg; msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); msg.header.size = htons (sizeof (msg)); @@ -1596,7 +1596,7 @@ send_channel_destroy (struct CadetTunnel *t, */ static void handle_data (struct CadetTunnel *t, - const struct GNUNET_CADET_Data *msg, + const struct GNUNET_CADET_ChannelDataMessage *msg, int fwd) { struct CadetChannel *ch; @@ -1607,7 +1607,7 @@ handle_data (struct CadetTunnel *t, /* Check size */ size = ntohs (msg->header.size); if (size < - sizeof (struct GNUNET_CADET_Data) + + sizeof (struct GNUNET_CADET_ChannelDataMessage) + sizeof (struct GNUNET_MessageHeader)) { GNUNET_break (0); @@ -1650,7 +1650,7 @@ handle_data (struct CadetTunnel *t, */ static void handle_data_ack (struct CadetTunnel *t, - const struct GNUNET_CADET_DataACK *msg, + const struct GNUNET_CADET_ChannelDataAckMessage *msg, int fwd) { struct CadetChannel *ch; @@ -1658,7 +1658,7 @@ handle_data_ack (struct CadetTunnel *t, /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_DataACK)) + if (size != sizeof (struct GNUNET_CADET_ChannelDataAckMessage)) { GNUNET_break (0); return; @@ -1687,14 +1687,14 @@ handle_data_ack (struct CadetTunnel *t, */ static void handle_ch_create (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelCreate *msg) + const struct GNUNET_CADET_ChannelCreateMessage *msg) { struct CadetChannel *ch; size_t size; /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_ChannelCreate)) + if (size != sizeof (struct GNUNET_CADET_ChannelCreateMessage)) { GNUNET_break_op (0); return; @@ -1722,14 +1722,14 @@ handle_ch_create (struct CadetTunnel *t, */ static void handle_ch_nack (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelManage *msg) + const struct GNUNET_CADET_ChannelManageMessage *msg) { struct CadetChannel *ch; size_t size; /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_ChannelManage)) + if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) { GNUNET_break (0); return; @@ -1763,7 +1763,7 @@ handle_ch_nack (struct CadetTunnel *t, */ static void handle_ch_ack (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd) { struct CadetChannel *ch; @@ -1771,7 +1771,7 @@ handle_ch_ack (struct CadetTunnel *t, /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_ChannelManage)) + if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) { GNUNET_break (0); return; @@ -1807,7 +1807,7 @@ handle_ch_ack (struct CadetTunnel *t, */ static void handle_ch_destroy (struct CadetTunnel *t, - const struct GNUNET_CADET_ChannelManage *msg, + const struct GNUNET_CADET_ChannelManageMessage *msg, int fwd) { struct CadetChannel *ch; @@ -1815,7 +1815,7 @@ handle_ch_destroy (struct CadetTunnel *t, /* Check size */ size = ntohs (msg->header.size); - if (size != sizeof (struct GNUNET_CADET_ChannelManage)) + if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) { GNUNET_break (0); return; @@ -1892,34 +1892,34 @@ handle_decrypted (struct CadetTunnel *t, switch (type) { - case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE: /* Do nothing, connection aleady got updated. */ GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO); break; - case GNUNET_MESSAGE_TYPE_CADET_DATA: + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA: /* Don't send hop ACK, wait for client to ACK */ - handle_data (t, (struct GNUNET_CADET_Data *) msgh, fwd); + handle_data (t, (struct GNUNET_CADET_ChannelDataMessage *) msgh, fwd); break; - case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: - handle_data_ack (t, (struct GNUNET_CADET_DataACK *) msgh, fwd); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_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_ChannelCreate *) msgh); + handle_ch_create (t, (struct GNUNET_CADET_ChannelCreateMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: - handle_ch_nack (t, (struct GNUNET_CADET_ChannelManage *) msgh); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED: + handle_ch_nack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh); break; - case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: - handle_ch_ack (t, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); + case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK: + handle_ch_ack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: - handle_ch_destroy (t, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); + handle_ch_destroy (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); break; default: @@ -1946,7 +1946,7 @@ handle_decrypted (struct CadetTunnel *t, */ void GCT_handle_encrypted (struct CadetTunnel *t, - const struct GNUNET_CADET_Encrypted *msg) + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg) { uint16_t size = ntohs (msg->header.size); char cbuf [size]; @@ -2005,7 +2005,7 @@ GCT_handle_encrypted (struct CadetTunnel *t, */ void GCT_handle_kx (struct CadetTunnel *t, - const struct GNUNET_CADET_KX *msg) + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) { struct CadetTunnelAxolotl *ax; struct GNUNET_HashCode key_material[3]; @@ -2158,9 +2158,9 @@ GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); expected_overhead = 0; - expected_overhead += sizeof (struct GNUNET_CADET_Encrypted); - expected_overhead += sizeof (struct GNUNET_CADET_Data); - expected_overhead += sizeof (struct GNUNET_CADET_ACK); + expected_overhead += sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage); + expected_overhead += sizeof (struct GNUNET_CADET_ChannelDataMessage); + expected_overhead += sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage); GNUNET_assert (GNUNET_CONSTANTS_CADET_P2P_OVERHEAD == expected_overhead); if (GNUNET_OK != @@ -2676,7 +2676,7 @@ GCT_destroy (struct CadetTunnel *t) mh = (struct GNUNET_MessageHeader *) &t->tq_head[1]; type = ntohs (mh->type); - if (0 == keepalives_queued && GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE == type) + if (0 == keepalives_queued && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE == type) { keepalives_queued = 1; LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -3221,7 +3221,7 @@ void GCT_send_kx (struct CadetTunnel *t, int force_reply) { struct CadetConnection *c; - struct GNUNET_CADET_KX msg; + struct GNUNET_CADET_TunnelKeyExchangeMessage msg; enum GNUNET_CADET_KX_Flags flags; LOG (GNUNET_ERROR_TYPE_INFO, "==> { KX} on %s\n", GCT_2s (t)); @@ -3244,7 +3244,7 @@ GCT_send_kx (struct CadetTunnel *t, int force_reply) } msg.header.size = htons (sizeof (msg)); - msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX); + msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX); flags = GNUNET_CADET_KX_FLAG_NONE; if (GNUNET_YES == force_reply) flags |= GNUNET_CADET_KX_FLAG_FORCE_REPLY; diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index 2d9a2b528..8d3d28f8d 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_Encrypted *msg); + const struct GNUNET_CADET_ConnectionEncryptedMessage *msg); /** @@ -315,7 +315,7 @@ GCT_handle_encrypted (struct CadetTunnel *t, */ void GCT_handle_kx (struct CadetTunnel *t, - const struct GNUNET_CADET_KX *msg); + const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); /** diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index ef9b27318..336184589 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h @@ -127,9 +127,9 @@ extern "C" /** * Size of the CADET message overhead: - * = sizeof (struct GNUNET_CADET_Encrypted) - * + sizeof (struct GNUNET_CADET_Data) - * + sizeof (struct GNUNET_CADET_ACK)) + * = sizeof (struct GNUNET_CADET_ConnectionEncryptedMessage) + * + sizeof (struct GNUNET_CADET_ChannelDataMessage) + * + 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 cea774932..4962a944a 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -2632,7 +2632,7 @@ extern "C" /** * Send origin an ACK that the connection is complete */ -#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK 1001 +#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK 1001 /** * Notify that a connection is no longer valid @@ -2647,44 +2647,44 @@ extern "C" /** * At some point, the route will spontaneously change TODO */ -#define GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED 1004 +#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTED 1004 /** * Hop-by-hop, connection dependent ACK. */ -#define GNUNET_MESSAGE_TYPE_CADET_ACK 1005 +#define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED_HOP_BY_HOP_ACK 1005 /** * Poll for a hop-by-hop ACK. */ -#define GNUNET_MESSAGE_TYPE_CADET_POLL 1006 +#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_POLL 1006 /** * Key exchange encapsulation. */ -#define GNUNET_MESSAGE_TYPE_CADET_KX 1007 +#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX 1007 /** * Axolotl encrypted data. */ -#define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED 1008 +#define GNUNET_MESSAGE_TYPE_CONNECTION_ENCRYPTED 1008 /********************************** Channel *********************************/ /** * Payload data (inside an encrypted tunnel). */ -#define GNUNET_MESSAGE_TYPE_CADET_DATA 1010 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA 1010 /** * Confirm payload data end-to-end. */ -#define GNUNET_MESSAGE_TYPE_CADET_DATA_ACK 1011 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK 1011 /** * Announce connection is still alive (direction sensitive). */ -#define GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE 1012 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE 1012 /** * Ask the cadet service to create a new channel. @@ -2699,12 +2699,12 @@ extern "C" /** * Confirm the creation of a channel */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK 1015 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK 1015 /** * Reject the creation of a channel */ -#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK 1016 +#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED 1016 /*********************************** Local **********************************/