*/
struct GNUNET_TIME_Absolute timestamp;
- /* struct GNUNET_CADET_ChannelDataMessage with payload */
+ /* struct GNUNET_CADET_ChannelAppDataMessage with payload */
};
/**
* Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
*/
- struct GNUNET_CADET_ChannelNumber gid;
+ struct GNUNET_CADET_ChannelTunnelNumber gid;
/**
* Local tunnel number for root (owner) client.
* @param rel Reliability data for retransmission.
*/
static struct CadetReliableMessage *
-copy_message (const struct GNUNET_CADET_ChannelDataMessage *msg, uint32_t mid,
+copy_message (const struct GNUNET_CADET_ChannelAppDataMessage *msg, uint32_t mid,
struct CadetChannelReliability *rel)
{
struct CadetReliableMessage *copy;
copy = GNUNET_malloc (sizeof (*copy) + size);
copy->mid = mid;
copy->rel = rel;
- copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA;
+ copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA;
GNUNET_memcpy (©[1], msg, size);
return copy;
* @param rel Reliability data to the corresponding direction.
*/
static void
-add_buffered_data (const struct GNUNET_CADET_ChannelDataMessage *msg,
+add_buffered_data (const struct GNUNET_CADET_ChannelAppDataMessage *msg,
struct CadetChannelReliability *rel)
{
struct CadetReliableMessage *copy;
}
/* Assign local id as destination */
- ch->lid_dest = GML_get_next_chid (c);
+ ch->lid_dest = GML_get_next_ccn (c);
/* Store in client's hashmap */
GML_channel_add (c, ch->lid_dest, ch);
msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
msg.header.size = htons (sizeof (msg));
- msg.chid = ch->gid;
+ msg.ctn = ch->gid;
/* If root is not NULL, notify.
* If it's NULL, check lid_root. When a local destroy comes in, root
*/
static void
send_client_data (struct CadetChannel *ch,
- const struct GNUNET_CADET_ChannelDataMessage *msg,
+ const struct GNUNET_CADET_ChannelAppDataMessage *msg,
int fwd)
{
if (fwd)
{
if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable)
{
- struct GNUNET_CADET_ChannelDataMessage *msg = (struct GNUNET_CADET_ChannelDataMessage *) ©[1];
+ struct GNUNET_CADET_ChannelAppDataMessage *msg = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1];
LOG (GNUNET_ERROR_TYPE_DEBUG, " have %u! now expecting %u\n",
copy->mid, rel->mid_recv + 1);
struct CadetChannelReliability *rel = cls;
struct CadetReliableMessage *copy;
struct CadetChannel *ch;
- struct GNUNET_CADET_ChannelDataMessage *payload;
+ struct GNUNET_CADET_ChannelAppDataMessage *payload;
int fwd;
rel->retry_task = NULL;
return;
}
- payload = (struct GNUNET_CADET_ChannelDataMessage *) ©[1];
+ payload = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1];
fwd = (rel == ch->root_rel);
/* Message not found in the queue that we are going to use. */
switch (chq->type)
{
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA:
LOG (GNUNET_ERROR_TYPE_DEBUG, "data MID %u sent\n", copy->mid);
GNUNET_assert (chq == copy->chq);
copy->timestamp = GNUNET_TIME_absolute_get ();
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK:
LOG (GNUNET_ERROR_TYPE_DEBUG, "sent %s\n", GC_m2s (chq->type));
rel = chq->rel;
GNUNET_assert (rel->uniq == chq);
rel->uniq = NULL;
if (CADET_CHANNEL_READY != rel->ch->state
- && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK != type
+ && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK != type
&& GNUNET_NO == rel->ch->destroy)
{
GNUNET_assert (NULL == rel->retry_task);
static void
send_create (struct CadetChannel *ch)
{
- struct GNUNET_CADET_ChannelCreateMessage msgcc;
+ struct GNUNET_CADET_ChannelOpenMessage msgcc;
msgcc.header.size = htons (sizeof (msgcc));
- msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
- msgcc.chid = ch->gid;
+ msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
+ msgcc.ctn = ch->gid;
msgcc.port = ch->port;
msgcc.opt = htonl (channel_get_options (ch));
struct GNUNET_CADET_ChannelManageMessage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK);
LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending channel %s ack for channel %s\n",
GC_f2s (fwd), GCCH_2s (ch));
- msg.chid =ch->gid;
+ msg.ctn =ch->gid;
GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL);
}
struct GNUNET_CADET_ChannelManageMessage msg;
msg.header.size = htons (sizeof (msg));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED);
LOG (GNUNET_ERROR_TYPE_DEBUG,
" sending channel NACK for channel %s\n",
GCCH_2s (ch));
- msg.chid = ch->gid;
+ msg.ctn = ch->gid;
GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL);
}
if (NULL != owner)
{
- ch->gid = GCT_get_next_chid (t);
+ ch->gid = GCT_get_next_ctn (t);
GML_channel_add (owner, lid_root, ch);
}
GCT_add_channel (t, ch);
switch (type)
{
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA:
/* Don't send hop ACK, wait for client to ACK */
LOG (GNUNET_ERROR_TYPE_DEBUG, "SEND loopback %u (%u)\n",
- ntohl (((struct GNUNET_CADET_ChannelDataMessage *) msgh)->mid), ntohs (msgh->size));
- GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelDataMessage *) msgh, fwd);
+ ntohl (((struct GNUNET_CADET_ChannelAppDataMessage *) msgh)->mid), ntohs (msgh->size));
+ GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelAppDataMessage *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK:
- GCCH_handle_data_ack (ch, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd);
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK:
+ GCCH_handle_data_ack (ch,
+ (const struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd);
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN:
GCCH_handle_create (ch->t,
- (struct GNUNET_CADET_ChannelCreateMessage *) msgh);
+ (const struct GNUNET_CADET_ChannelOpenMessage *) msgh);
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK:
GCCH_handle_ack (ch,
- (struct GNUNET_CADET_ChannelManageMessage *) msgh,
+ (const struct GNUNET_CADET_ChannelManageMessage *) msgh,
fwd);
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED:
GCCH_handle_nack (ch);
break;
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
GCCH_handle_destroy (ch,
- (struct GNUNET_CADET_ChannelManageMessage *) msgh,
+ (const struct GNUNET_CADET_ChannelManageMessage *) msgh,
fwd);
break;
*
* @return ID used to identify the channel with the remote peer.
*/
-struct GNUNET_CADET_ChannelNumber
+struct GNUNET_CADET_ChannelTunnelNumber
GCCH_get_id (const struct CadetChannel *ch)
{
return ch->gid;
rel = fwd ? ch->dest_rel : ch->root_rel;
ack = rel->mid_recv - 1;
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK);
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK);
msg.header.size = htons (sizeof (msg));
- msg.chid = ch->gid;
+ msg.ctn = 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_CHANNEL_DATA)
+ if (copy->type != GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " Type %s, expected DATA\n",
GC_m2s (copy->type));
size_t size)
{
struct CadetChannelReliability *rel;
- struct GNUNET_CADET_ChannelDataMessage *payload;
- uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelDataMessage) + size;
+ struct GNUNET_CADET_ChannelAppDataMessage *payload;
+ uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelAppDataMessage) + size;
unsigned char cbuf[p2p_size];
unsigned char buffer;
rel->client_allowed = GNUNET_NO;
/* Ok, everything is correct, send the message. */
- payload = (struct GNUNET_CADET_ChannelDataMessage *) cbuf;
+ payload = (struct GNUNET_CADET_ChannelAppDataMessage *) cbuf;
payload->mid = htonl (rel->mid_send);
rel->mid_send++;
GNUNET_memcpy (&payload[1], message, size);
payload->header.size = htons (p2p_size);
- payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA);
- payload->chid = ch->gid;
+ payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA);
+ payload->ctn = ch->gid;
LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL);
* @param c Client that requested the creation (will be the root).
* @param msg Create Channel message.
*
- * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
+ * @return #GNUNET_OK if everything went fine, #GNUNET_SYSERR otherwise.
*/
int
GCCH_handle_local_create (struct CadetClient *c,
- struct GNUNET_CADET_ChannelCreateMessageMessage *msg)
+ struct GNUNET_CADET_LocalChannelCreateMessage *msg)
{
struct CadetChannel *ch;
struct CadetTunnel *t;
struct CadetPeer *peer;
- struct GNUNET_CADET_ClientChannelNumber chid;
+ struct GNUNET_CADET_ClientChannelNumber ccn;
LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n",
GNUNET_i2s (&msg->peer), GNUNET_h2s (&msg->port));
- chid = msg->channel_id;
+ ccn = msg->ccn;
/* Sanity check for duplicate channel IDs */
- if (NULL != GML_channel_get (c, chid))
+ if (NULL != GML_channel_get (c, ccn))
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
/* Create channel */
- ch = channel_new (t, c, chid);
+ ch = channel_new (t, c, ccn);
if (NULL == ch)
{
GNUNET_break (0);
*/
void
GCCH_handle_data (struct CadetChannel *ch,
- const struct GNUNET_CADET_ChannelDataMessage *msg,
+ const struct GNUNET_CADET_ChannelAppDataMessage *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_CHANNEL_DATA), GC_m2s (payload_type), mid,
+ GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA), GC_m2s (payload_type), mid,
GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
if ( (GNUNET_NO == ch->reliable) ||
ack = ntohl (msg->mid);
LOG (GNUNET_ERROR_TYPE_INFO,
"<== %s (0x%010lX %4u) on chan %s (%p) %s [%5u]\n",
- GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK), msg->futures, ack,
+ GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK), msg->futures, ack,
GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
if (GNUNET_YES == fwd)
*/
struct CadetChannel *
GCCH_handle_create (struct CadetTunnel *t,
- const struct GNUNET_CADET_ChannelCreateMessage *msg)
+ const struct GNUNET_CADET_ChannelOpenMessage *msg)
{
- struct GNUNET_CADET_ClientChannelNumber chid;
- struct GNUNET_CADET_ChannelNumber gid;
+ struct GNUNET_CADET_ClientChannelNumber ccn;
+ struct GNUNET_CADET_ChannelTunnelNumber gid;
struct CadetChannel *ch;
struct CadetClient *c;
int new_channel;
const struct GNUNET_HashCode *port;
- gid = msg->chid;
+ gid = msg->ctn;
ch = GCT_get_channel (t, gid);
if (NULL == ch)
{
/* Create channel */
- chid.channel_of_client = htonl (0);
- ch = channel_new (t, NULL, chid);
+ ccn.channel_of_client = htonl (0);
+ ch = channel_new (t, NULL, ccn);
ch->gid = gid;
channel_set_options (ch, ntohl (msg->opt));
new_channel = GNUNET_YES;
LOG (GNUNET_ERROR_TYPE_INFO,
"<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n",
- GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE), chid, port,
+ GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN), ccn, port,
GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size));
if (GNUNET_YES == new_channel || GCT_is_loopback (t))
{
LOG (GNUNET_ERROR_TYPE_INFO,
"<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n",
- GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED), ch->gid, 0,
+ GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED), ch->gid, 0,
GCCH_2s (ch), ch, "---", 0);
send_client_nack (ch);
{
LOG (GNUNET_ERROR_TYPE_INFO,
"<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n",
- GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK), ch->gid, 0,
+ GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK), ch->gid, 0,
GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size));
/* If this is a remote (non-loopback) channel, find 'fwd'. */
data_id = 0;
switch (type)
{
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA:
{
- struct GNUNET_CADET_ChannelDataMessage *data_msg;
+ struct GNUNET_CADET_ChannelAppDataMessage *data_msg;
struct GNUNET_MessageHeader *payload_msg;
uint16_t payload_type;
- data_msg = (struct GNUNET_CADET_ChannelDataMessage *) message;
+ data_msg = (struct GNUNET_CADET_ChannelAppDataMessage *) message;
data_id = ntohl (data_msg->mid);
payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1];
payload_type = ntohs (payload_msg->type);
info[31] = '\0';
break;
}
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK:
{
struct GNUNET_CADET_ChannelDataAckMessage *ack_msg;
ack_msg = (struct GNUNET_CADET_ChannelDataAckMessage *) message;
(unsigned long int) ack_msg->futures);
break;
}
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN:
{
- struct GNUNET_CADET_ChannelCreateMessage *cc_msg;
- cc_msg = (struct GNUNET_CADET_ChannelCreateMessage *) message;
- SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid.cn));
+ struct GNUNET_CADET_ChannelOpenMessage *cc_msg;
+ cc_msg = (struct GNUNET_CADET_ChannelOpenMessage *) message;
+ SPRINTF (info, " 0x%08X", ntohl (cc_msg->ctn.cn));
break;
}
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED:
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
{
struct GNUNET_CADET_ChannelManageMessage *m_msg;
m_msg = (struct GNUNET_CADET_ChannelManageMessage *) message;
- SPRINTF (info, " 0x%08X", ntohl (m_msg->chid.cn));
+ SPRINTF (info, " 0x%08X", ntohl (m_msg->ctn.cn));
break;
}
default:
switch (type)
{
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA:
if (GNUNET_YES == ch->reliable)
{
chq = GNUNET_new (struct CadetChannelQueue);
break;
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DATA_ACK:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK:
chq = GNUNET_new (struct CadetChannelQueue);
chq->type = type;
chq->rel = fwd ? ch->root_rel : ch->dest_rel;
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
- case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE_NACK_DEPRECATED:
+ case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED:
fire_and_forget (message, ch, GNUNET_YES);
break;