Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
/**
* @file cadet/gnunet-service-cadet-new_channel.c
* @brief logical links between CADET clients
* @author Bartlomiej Polot
* @author Christian Grothoff
+ *
+ * TODO:
+ * - estimate max bandwidth using bursts and use to for CONGESTION CONTROL!
+ * - check that '0xFFULL' really is sufficient for flow control!
+ * - what about the 'no buffer' option?
+ * - what about the 'out-of-order' option?
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "cadet.h"
/**
* Number identifying this channel in its tunnel.
*/
- struct GNUNET_CADET_ChannelTunnelNumber gid;
+ struct GNUNET_CADET_ChannelTunnelNumber chid;
/**
* Local tunnel number for local client owning the channel.
return "(NULL Channel)";
GNUNET_snprintf (buf,
sizeof (buf),
- "%s:%s gid:%X (%X)",
+ "%s:%s chid:%X (%X)",
GCT_2s (ch->t),
GNUNET_h2s (&ch->port),
- ch->gid,
+ ch->chid,
ntohl (ch->lid.channel_of_client));
return buf;
}
struct GNUNET_CADET_ChannelTunnelNumber
GCCH_get_id (const struct CadetChannel *ch)
{
- return ch->gid;
+ return ch->chid;
}
}
GCT_remove_channel (ch->t,
ch,
- ch->gid);
+ ch->chid);
GNUNET_free (ch);
}
msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
msgcc.opt = htonl (options);
msgcc.port = ch->port;
- msgcc.chid = ch->gid;
+ msgcc.chid = ch->chid;
ch->state = CADET_CHANNEL_CREATE_SENT;
ch->last_control_qe = GCT_send (ch->t,
&msgcc.header,
ch->port = *port;
ch->t = GCP_get_tunnel (destination,
GNUNET_YES);
- ch->gid = GCT_add_channel (ch->t,
- ch);
+ ch->chid = GCT_add_channel (ch->t,
+ ch);
ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME;
ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER));
ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE));
/**
- * Create a new channel.
+ * Create a new channel based on a request coming in over the network.
*
* @param t tunnel to the remote peer
- * @param gid identifier of this channel in the tunnel
+ * @param chid identifier of this channel in the tunnel
* @param port desired local port
* @param options options for the channel
* @return handle to the new channel
*/
struct CadetChannel *
GCCH_channel_incoming_new (struct CadetTunnel *t,
- struct GNUNET_CADET_ChannelTunnelNumber gid,
+ struct GNUNET_CADET_ChannelTunnelNumber chid,
const struct GNUNET_HashCode *port,
uint32_t options)
{
or adjust dynamically... */
ch->port = *port;
ch->t = t;
- ch->gid = gid;
+ ch->chid = chid;
ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME;
ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER));
ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK);
msg.header.size = htons (sizeof (msg));
- msg.gid = ch->gid;
+ msg.gid = ch->chid;
msg.mid.mid = htonl (ntohl (ch->mid_recv.mid) - 1);
msg.futures = GNUNET_htonll (ch->mid_futures);
if (NULL != ch->last_control_qe)
return;
}
/* Nothing left to do, just finish destruction */
+ GCT_send_channel_destroy (ch->t,
+ ch->chid);
channel_destroy (ch);
}
return;
}
/* Nothing left to do, just finish destruction */
+ GCT_send_channel_destroy (ch->t,
+ ch->chid);
channel_destroy (ch);
}
crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA);
ch->mid_send.mid = htonl (ntohl (ch->mid_send.mid) + 1);
crm->data_message.mid = ch->mid_send;
- crm->data_message.gid = ch->gid;
+ crm->data_message.gid = ch->chid;
GNUNET_memcpy (&crm[1],
message,
payload_size);
return;
if (GNUNET_NO == ch->destroy)
return;
+ GCT_send_channel_destroy (ch->t,
+ ch->chid);
channel_destroy (ch);
}
LOG2 (level,
"CHN Channel %s:%X (%p)\n",
GCT_2s (ch->t),
- ch->gid,
+ ch->chid,
ch);
if (NULL != ch->owner)
{