struct GNUNET_MessageHeader header;
/**
- * For alignment.
+ * Connection options in network byte order.
+ * #GNUNET_CADET_OPTION_DEFAULT for buffered;
+ * #GNUNET_CADET_OPTION_NOBUFFER for unbuffered.
+ * Other flags are ignored and should not be set at this level.
*/
- uint32_t reserved GNUNET_PACKED;
+ uint32_t options GNUNET_PACKED;
/**
* ID of the connection
*/
enum CadetConnectionState state;
+ /**
+ * Options for the route, control buffering.
+ */
+ enum GNUNET_CADET_ChannelOption options;
+
/**
* Offset of our @e destination in @e path.
*/
env = GNUNET_MQ_msg_extra (create_msg,
(1 + path_length) * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
+ create_msg->options = htonl ((uint32_t) cc->options);
create_msg->cid = cc->cid;
pids = (struct GNUNET_PeerIdentity *) &create_msg[1];
pids[0] = my_full_id;
*
* @param destination where to go
* @param path which path to take (may not be the full path)
+ * @param options options for the connection
* @param ct which tunnel uses this connection
* @param init_state initial state for the connection
* @param ready_cb function to call when ready to transmit
static struct CadetConnection *
connection_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
enum CadetConnectionState init_state,
destination);
GNUNET_assert (UINT_MAX > off);
cc = GNUNET_new (struct CadetConnection);
+ cc->options = options;
cc->state = init_state;
cc->ct = ct;
cc->cid = *cid;
*
* @param destination where to go
* @param path which path to take (may not be the full path)
+ * @param options options for the connection
* @param ct which tunnel uses this connection
* @param ready_cb function to call when ready to transmit
* @param ready_cb_cls closure for @a cb
struct CadetConnection *
GCC_create_inbound (struct CadetPeer *destination,
struct CadetPeerPath *path,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
GCC_ReadyCallback ready_cb,
return connection_create (destination,
path,
+ options,
ct,
cid,
CADET_CONNECTION_CREATE_RECEIVED,
*
* @param destination where to go
* @param path which path to take (may not be the full path)
+ * @param options options for the connection
* @param ct tunnel that uses the connection
* @param ready_cb function to call when ready to transmit
* @param ready_cb_cls closure for @a cb
struct CadetConnection *
GCC_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
GCC_ReadyCallback ready_cb,
void *ready_cb_cls)
sizeof (cid));
return connection_create (destination,
path,
+ options,
ct,
&cid,
CADET_CONNECTION_NEW,
*
* @param destination where to go
* @param path which path to take (may not be the full path)
+ * @param options options for the connection
* @param ct which tunnel uses this connection
* @param ready_cb function to call when ready to transmit
* @param ready_cb_cls closure for @a cb
struct CadetConnection *
GCC_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
GCC_ReadyCallback ready_cb,
void *ready_cb_cls);
*
* @param destination where to go
* @param path which path to take (may not be the full path)
+ * @param options options for the connection
* @param ct which tunnel uses this connection
* @param ready_cb function to call when ready to transmit
* @param ready_cb_cls closure for @a cb
struct CadetConnection *
GCC_create_inbound (struct CadetPeer *destination,
struct CadetPeerPath *path,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
GCC_ReadyCallback ready_cb,
*
* TODO:
* - properly implement GLOBAL message buffer, instead of per-route buffers
+ * - do NOT use buffering if the route options say no buffer!
* - Optimization: given BROKEN messages, destroy paths (?)
*/
#include "platform.h"
* Position of this route in the #route_heap.
*/
struct GNUNET_CONTAINER_HeapNode *hn;
+
+ /**
+ * Options for the route, control buffering.
+ */
+ enum GNUNET_CADET_ChannelOption options;
};
uint16_t size = ntohs (msg->header.size) - sizeof (*msg);
unsigned int path_length;
unsigned int off;
+ enum GNUNET_CADET_ChannelOption options;
+ options = (enum GNUNET_CADET_ChannelOption) ntohl (msg->options);
path_length = size / sizeof (struct GNUNET_PeerIdentity);
/* Initiator is at offset 0. */
for (off=1;off<path_length;off++)
GCT_add_inbound_connection (GCP_get_tunnel (origin,
GNUNET_YES),
&msg->cid,
+ (enum GNUNET_CADET_ChannelOption) ntohl (msg->options),
path))
{
/* Send back BROKEN: duplicate connection on the same path,
GNUNET_i2s (&pids[off + 1]),
off + 1);
route = GNUNET_new (struct CadetRoute);
+ route->options = options;
route->cid = msg->cid;
route->last_use = GNUNET_TIME_absolute_get ();
dir_init (&route->prev,
ct->t = t;
ct->cc = GCC_create (t->destination,
path,
+ GNUNET_CADET_OPTION_DEFAULT, /* FIXME: set based on what channels want/need! */
ct,
&connection_ready_cb,
ct);
*
* @param t a tunnel
* @param cid connection identifer to use for the connection
+ * @param options options for the connection
* @param path path to use for the connection
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on failure (duplicate connection)
int
GCT_add_inbound_connection (struct CadetTunnel *t,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetPeerPath *path)
{
struct CadetTConnection *ct;
ct->t = t;
ct->cc = GCC_create_inbound (t->destination,
path,
+ options,
ct,
cid,
&connection_ready_cb,
*
* @param t a tunnel
* @param cid connection identifer to use for the connection
+ * @param options options for the connection
* @param path path to use for the connection
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on failure (duplicate connection)
int
GCT_add_inbound_connection (struct CadetTunnel *t,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
+ enum GNUNET_CADET_ChannelOption options,
struct CadetPeerPath *path);
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);
+ msg->options = htonl (0);
msg->cid = *GCC_get_id (c);
peers = (struct GNUNET_PeerIdentity *) &msg[1];
for (int i = 0; i < c->path->length; i++)