#include "gnunet_statistics_service.h"
#include "cadet_protocol.h"
-
#define LOG(level, ...) GNUNET_log_from(level,"cadet-cor",__VA_ARGS__)
/**
*/
struct RouteDirection;
-
/**
* Set of CadetRoutes that have exactly the same number of messages
* in their buffer. Used so we can efficiently find all of those
static void
route_message (struct CadetPeer *prev,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
- const struct GNUNET_MessageHeader *msg)
+ const struct GNUNET_MessageHeader *msg,
+ const enum GNUNET_MQ_PriorityPreferences priority)
{
struct CadetRoute *route;
struct RouteDirection *dir;
}
/* Check if buffering is disallowed, and if so, make sure we only queue
one message per direction. */
- if ( (0 != (route->options & GNUNET_CADET_OPTION_NOBUFFER)) &&
+ if ( (0 != (priority & GNUNET_MQ_PREF_NO_BUFFER)) &&
(NULL != dir->env_head) )
discard_buffer (dir,
dir->env_head);
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);
if (0 == path_length)
{
GNUNET_sh2s (&msg->cid.connection_of_tunnel));
route_message (sender,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
return;
}
if (off == path_length - 1)
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,
/* also pass CREATE message along to next hop */
route_message (sender,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
}
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
}
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PREF_NO_BUFFER);
route = get_route (&msg->cid);
if (NULL != route)
destroy_route (route);
GNUNET_sh2s (&msg->cid.connection_of_tunnel));
route_message (peer,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PREF_NO_BUFFER);
route = get_route (&msg->cid);
if (NULL != route)
destroy_route (route);
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
}
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->kx.cid,
- &msg->kx.header);
+ &msg->kx.header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
}
/* We're just an intermediary peer, route the message along its path */
route_message (peer,
&msg->cid,
- &msg->header);
+ &msg->header,
+ GNUNET_MQ_PRIO_CRITICAL_CONTROL);
}
"CADET",
"MAX_ROUTES",
&max_routes))
- max_routes = 5000;
+ max_routes = 5000;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c,
"CADET",
"MAX_MSGS_QUEUE",
&max_buffers))
- max_buffers = 10000;
+ max_buffers = 10000;
routes = GNUNET_CONTAINER_multishortmap_create (1024,
GNUNET_NO);
route_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
ct->cc = GCC_create (t->destination,
path,
off,
- GNUNET_CADET_OPTION_DEFAULT, /* FIXME: set based on what channels want/need! */
ct,
&connection_ready_cb,
ct);
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,
mh,
&mh->target,
&port,
- GNUNET_CADET_OPTION_RELIABLE,
&window_change_cb,
&disconnect_cb,
handlers);
GNUNET_i2s (&mh->target));
env = GNUNET_MQ_msg (sqm,
GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
+ GNUNET_MQ_env_set_options(env,
+ GNUNET_MQ_PREF_RELIABLE);
sqm->type = htonl (sr->type);
sqm->query = sr->query;
GNUNET_MQ_notify_sent (env,
mh,
&mh->target,
&port,
- GNUNET_CADET_OPTION_RELIABLE,
&window_change_cb,
&disconnect_cb,
handlers);
/**
* Flag to indicate that out-of-order delivery is OK.
*/
- GNUNET_MQ_PREF_OUT_OF_ORDER = 256
+ GNUNET_MQ_PREF_OUT_OF_ORDER = 256,
+
+ /**
+ * Flag to indicate no buffering.
+ */
+ GNUNET_MQ_PREF_NO_BUFFER = 512,
+
+ /**
+ * Flag to indicate default
+ */
+ GNUNET_MQ_PREF_DEFAULT = 1024,
+
+ /**
+ * Flag to indicate reliable
+ */
+ GNUNET_MQ_PREF_RELIABLE = 2048
};
pos,
&pos->peer,
&port,
- GNUNET_CADET_OPTION_DEFAULT,
&channel_idle_notify_cb,
&cadet_channel_end_cb,
cadet_handlers);
e = GNUNET_MQ_msg_extra (msg,
todo_count * 2 * sizeof (struct GNUNET_CRYPTO_EccPoint),
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_ALICE_CRYPTODATA);
+ GNUNET_MQ_env_set_options(e,
+ GNUNET_MQ_PREF_RELIABLE);
msg->contained_element_count = htonl (todo_count);
payload = (struct GNUNET_CRYPTO_EccPoint *) &msg[1];
r_ia = gcry_mpi_new (0);
s,
&s->peer,
&s->session_id,
- GNUNET_CADET_OPTION_RELIABLE,
NULL,
&cb_channel_destruction,
cadet_handlers);
e = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_SESSION_INITIALIZATION);
+ GNUNET_MQ_env_set_options(e,
+ GNUNET_MQ_PREF_RELIABLE);
msg->session_id = s->session_id;
GNUNET_MQ_send (s->cadet_mq,
e);
e = GNUNET_MQ_msg_extra (msg,
todo_count * sizeof (struct GNUNET_CRYPTO_PaillierCiphertext),
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA);
+ GNUNET_MQ_env_set_options(e,
+ GNUNET_MQ_PREF_RELIABLE);
msg->contained_element_count = htonl (todo_count);
payload = (struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
a = gcry_mpi_new (0);
s,
&s->peer,
&s->session_id,
- GNUNET_CADET_OPTION_RELIABLE,
NULL,
&cb_channel_destruction,
cadet_handlers);
e = GNUNET_MQ_msg (msg,
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SESSION_INITIALIZATION);
+ GNUNET_MQ_env_set_options(e,
+ GNUNET_MQ_PREF_RELIABLE);
msg->session_id = s->session_id;
msg->public_key = my_pubkey;
GNUNET_MQ_send (s->cadet_mq,
env = GNUNET_MQ_msg_nested_mh (cmsg,
GNUNET_MESSAGE_TYPE_SET_REQUEST,
op->context_msg);
+ GNUNET_MQ_env_set_options(env,
+ GNUNET_MQ_PREF_RELIABLE);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Suggesting incoming request with accept id %u to listener %p of client %p\n",
op->suggest_id,
op,
&msg->target_peer,
&msg->app_id,
- GNUNET_CADET_OPTION_RELIABLE,
&channel_window_cb,
&channel_end_cb,
cadet_handlers);
GNUNET_assert (NULL != ts->channel);
mq = GNUNET_CADET_get_mq (ts->channel);
+ GNUNET_MQ_env_set_options(env,
+ GNUNET_MQ_PREF_DEFAULT);
GNUNET_MQ_send (mq,
env);
if (GNUNET_MQ_get_length (mq) > MAX_MESSAGE_QUEUE_SIZE)
ts,
target,
port,
- GNUNET_CADET_OPTION_DEFAULT,
NULL,
&channel_cleaner,
cadet_handlers);