/**
* 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;
*/
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;
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,
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 ()
};
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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Message for notifying a disconnection in a path
*/
-struct GNUNET_CADET_ConnectionBroken
+struct GNUNET_CADET_ConnectionBrokenMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
/**
* Message to destroy a connection.
*/
-struct GNUNET_CADET_ConnectionDestroy
+struct GNUNET_CADET_ConnectionDestroyMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Message to create a Channel.
*/
-struct GNUNET_CADET_ChannelCreate
+struct GNUNET_CADET_ChannelCreateMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
/**
* 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}
/**
* Message for cadet data traffic.
*/
-struct GNUNET_CADET_Data
+struct GNUNET_CADET_ChannelDataMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
/**
* 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;
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);
*/
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;
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,
/**
* Message to create a Channel.
*/
-struct GNUNET_CADET_ChannelCreate
+struct GNUNET_CADET_ChannelCreateMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
/**
* Message for cadet data traffic.
*/
-struct GNUNET_CADET_Data
+struct GNUNET_CADET_ChannelDataMessage
{
/**
* Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
/**
* 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;
/**
* Data message we are trying to send.
*/
- struct GNUNET_CADET_Data data_message;
+ struct GNUNET_CADET_ChannelDataMessage data_message;
/* followed by variable-size payload */
};
/**
* 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;
send_create (void *cls)
{
struct CadetChannel *ch = cls;
- struct GNUNET_CADET_ChannelCreate msgcc;
+ struct GNUNET_CADET_ChannelCreateMessage msgcc;
uint32_t options;
options = 0;
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);
/* 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;
{
/* 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);
*/
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);
*/
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);
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;
*/
void
GCC_handle_kx (struct CadetConnection *cc,
- const struct GNUNET_CADET_KX *msg);
+ const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg);
/**
*/
void
GCC_handle_encrypted (struct CadetConnection *cc,
- const struct GNUNET_CADET_Encrypted *msg);
+ const struct GNUNET_CADET_ConnectionEncryptedMessage *msg);
/**
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);
*/
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);
*/
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);
/**
- * 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;
*/
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;
*/
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;
/**
- * 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;
/**
- * 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;
/**
- * 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;
*/
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;
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 ()
};
*/
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;
*/
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;
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;
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;
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 */
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 */
*/
static int
check_plaintext_data (void *cls,
- const struct GNUNET_CADET_Data *msg)
+ const struct GNUNET_CADET_ChannelDataMessage *msg)
{
return GNUNET_OK;
}
*/
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!
*/
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!
*/
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!
*/
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!
*/
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!
*/
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!
{
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 ()
};
*/
void
GCT_handle_kx (struct CadetTConnection *ct,
- const struct GNUNET_CADET_KX *msg)
+ const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
{
GNUNET_break (0); // not implemented
}
*/
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);
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,
*/
void
GCT_handle_kx (struct CadetTConnection *ct,
- const struct GNUNET_CADET_KX *msg);
+ const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg);
/**
*/
void
GCT_handle_encrypted (struct CadetTConnection *ct,
- const struct GNUNET_CADET_Encrypted *msg);
+ const struct GNUNET_CADET_ConnectionEncryptedMessage *msg);
/**
*/
struct GNUNET_TIME_Absolute timestamp;
- /* struct GNUNET_CADET_Data with payload */
+ /* struct GNUNET_CADET_ChannelDataMessage with payload */
};
* @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;
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;
* @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;
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));
*/
static void
send_client_data (struct CadetChannel *ch,
- const struct GNUNET_CADET_Data *msg,
+ const struct GNUNET_CADET_ChannelDataMessage *msg,
int fwd)
{
if (fwd)
{
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);
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;
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. */
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 ();
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);
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);
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));
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));
*/
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;
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;
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;
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);
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));
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;
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);
*/
int
GCCH_handle_local_create (struct CadetClient *c,
- struct GNUNET_CADET_ChannelCreateMessage *msg)
+ struct GNUNET_CADET_ChannelCreateMessageMessage *msg)
{
struct CadetChannel *ch;
struct CadetTunnel *t;
*/
void
GCCH_handle_data (struct CadetChannel *ch,
- const struct GNUNET_CADET_Data *msg,
+ const struct GNUNET_CADET_ChannelDataMessage *msg,
int fwd)
{
struct CadetChannelReliability *rel;
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) ||
*/
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;
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)
*/
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;
{
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);
*/
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'. */
*/
void
GCCH_handle_destroy (struct CadetChannel *ch,
- const struct GNUNET_CADET_ChannelManage *msg,
+ const struct GNUNET_CADET_ChannelManageMessage *msg,
int fwd)
{
struct CadetChannelReliability *rel;
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);
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);
}
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;
}
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);
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;
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;
*/
int
GCCH_handle_local_create (struct CadetClient *c,
- struct GNUNET_CADET_ChannelCreateMessage *msg);
+ struct GNUNET_CADET_ChannelCreateMessageMessage *msg);
/**
* Handler for cadet network payload traffic.
*/
void
GCCH_handle_data (struct CadetChannel *ch,
- const struct GNUNET_CADET_Data *msg,
+ const struct GNUNET_CADET_ChannelDataMessage *msg,
int fwd);
*/
void
GCCH_handle_data_ack (struct CadetChannel *ch,
- const struct GNUNET_CADET_DataACK *msg,
+ const struct GNUNET_CADET_ChannelDataAckMessage *msg,
int fwd);
*/
struct CadetChannel *
GCCH_handle_create (struct CadetTunnel *t,
- const struct GNUNET_CADET_ChannelCreate *msg);
+ const struct GNUNET_CADET_ChannelCreateMessage *msg);
/**
*/
void
GCCH_handle_ack (struct CadetChannel *ch,
- const struct GNUNET_CADET_ChannelManage *msg,
+ const struct GNUNET_CADET_ChannelManageMessage *msg,
int fwd);
*/
void
GCCH_handle_destroy (struct CadetChannel *ch,
- const struct GNUNET_CADET_ChannelManage *msg,
+ const struct GNUNET_CADET_ChannelManageMessage *msg,
int fwd);
{
struct CadetFlowControl *next_fc;
struct CadetFlowControl *prev_fc;
- struct GNUNET_CADET_ACK msg;
+ struct GNUNET_CADET_ConnectionEncryptedAckMessage msg;
uint32_t ack;
int delta;
/* 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;
}
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;
}
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;
}
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)
{
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;
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;
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",
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);
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);
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,
send_poll (void *cls)
{
struct CadetFlowControl *fc = cls;
- struct GNUNET_CADET_Poll msg;
+ struct GNUNET_CADET_ConnectionHopByHopPollMessage msg;
struct CadetConnection *c;
int fwd;
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);
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 = "==";
*/
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;
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);
*/
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;
*/
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;
*/
void
GCC_handle_destroy (struct CadetPeer *peer,
- const struct GNUNET_CADET_ConnectionDestroy *msg)
+ const struct GNUNET_CADET_ConnectionDestroyMessage *msg)
{
struct CadetConnection *c;
int fwd;
*/
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;
*/
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;
/* 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",
*/
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;
*/
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;
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)
}
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);
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--;
}
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);
void
GCC_send_destroy (struct CadetConnection *c)
{
- struct GNUNET_CADET_ConnectionDestroy msg;
+ struct GNUNET_CADET_ConnectionDestroyMessage msg;
if (GNUNET_YES == c->destroy)
return;
*/
void
GCC_handle_create (struct CadetPeer *peer,
- const struct GNUNET_CADET_ConnectionCreate *msg);
+ const struct GNUNET_CADET_ConnectionCreateMessage *msg);
/**
*/
void
GCC_handle_confirm (struct CadetPeer *peer,
- const struct GNUNET_CADET_ConnectionACK *msg);
+ const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg);
/**
*/
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.
*/
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.
*/
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.
*/
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).
*/
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).
*/
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.
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);
if (GNUNET_OK !=
GCCH_handle_local_create (c,
- (struct GNUNET_CADET_ChannelCreateMessage *)
+ (struct GNUNET_CADET_ChannelCreateMessageMessage *)
message))
{
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
{&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},
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);
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,
*/
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))
*/
void
GML_send_data (struct CadetClient *c,
- const struct GNUNET_CADET_Data *msg,
+ const struct GNUNET_CADET_ChannelDataMessage *msg,
struct GNUNET_CADET_ClientChannelNumber id);
/**
* @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;
* @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);
/**
- * 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);
* @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);
* @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);
/**
- * 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);
/**
- * 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);
/**
- * 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);
* @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)
}
/**
- * 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);
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 ()
};
}
/* 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;
}
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;
}
* @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;
* @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;
*/
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;
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)
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 */
*/
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;
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;
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);
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);
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));
*/
static void
handle_data (struct CadetTunnel *t,
- const struct GNUNET_CADET_Data *msg,
+ const struct GNUNET_CADET_ChannelDataMessage *msg,
int fwd)
{
struct CadetChannel *ch;
/* 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);
*/
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;
/* 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;
*/
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;
*/
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;
*/
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;
/* 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;
*/
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;
/* 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;
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:
*/
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];
*/
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];
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 !=
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,
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));
}
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;
*/
void
GCT_handle_encrypted (struct CadetTunnel *t,
- const struct GNUNET_CADET_Encrypted *msg);
+ const struct GNUNET_CADET_ConnectionEncryptedMessage *msg);
/**
*/
void
GCT_handle_kx (struct CadetTunnel *t,
- const struct GNUNET_CADET_KX *msg);
+ const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg);
/**
/**
* 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().
*/
/**
* 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
/**
* 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.
/**
* 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 **********************************/