#define LOG(kind, ...) GNUNET_log_from (kind, "cadet-api", __VA_ARGS__)
+enum GNUNET_CADET_ChannelInfoOption
+{
+ /**
+ * Who is the peer at the other end of the channel.
+ * Only for use in @c GNUNET_CADET_channel_get_info
+ * struct GNUNET_PeerIdentity *peer
+ */
+ GNUNET_CADET_OPTION_PEER = 0x0
+
+};
+
/**
* Opaque handle to the service.
*/
*/
struct GNUNET_CADET_ClientChannelNumber ccn;
- /**
- * Channel options: reliability, etc.
- */
- enum GNUNET_CADET_ChannelOption options;
-
/**
* How many messages are we allowed to send to the service right now?
*/
ch = create_channel (h, &ccn);
ch->peer = msg->peer;
ch->incoming_port = port;
- ch->options = ntohl (msg->opt);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Creating incoming channel %X [%s] %p\n",
ntohl (ccn.channel_of_client),
*/
const union GNUNET_CADET_ChannelInfo *
GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
- enum GNUNET_CADET_ChannelOption option,
+ enum GNUNET_CADET_ChannelInfoOption option,
...)
{
static int bool_flag;
switch (option)
{
- case GNUNET_CADET_OPTION_NOBUFFER:
- case GNUNET_CADET_OPTION_RELIABLE:
- case GNUNET_CADET_OPTION_OUT_OF_ORDER:
- if (0 != (option & channel->options))
- bool_flag = GNUNET_YES;
- else
- bool_flag = GNUNET_NO;
- return (const union GNUNET_CADET_ChannelInfo *) &bool_flag;
- break;
- case GNUNET_CADET_OPTION_PEER:
- return (const union GNUNET_CADET_ChannelInfo *) &channel->peer;
- break;
- default:
- GNUNET_break (0);
- return NULL;
+ case GNUNET_CADET_OPTION_PEER:
+ return (const union GNUNET_CADET_ChannelInfo *) &channel->peer;
+ break;
+ default:
+ GNUNET_break (0);
+ return NULL;
}
+ return (const union GNUNET_CADET_ChannelInfo *) &channel->peer;
}
void *channel_cls,
const struct GNUNET_PeerIdentity *destination,
const struct GNUNET_HashCode *port,
- enum GNUNET_CADET_ChannelOption options,
GNUNET_CADET_WindowSizeEventHandler window_changes,
GNUNET_CADET_DisconnectEventHandler disconnects,
const struct GNUNET_MQ_MessageHandler *handlers)
ch = create_channel (h, NULL);
ch->ctx = channel_cls;
ch->peer = *destination;
- ch->options = options;
ch->window_changes = window_changes;
ch->disconnects = disconnects;
msg->ccn = ch->ccn;
msg->port = *port;
msg->peer = *destination;
+<<<<<<< 17611641fe7da3d2711e1f20eaf2ee81faf0e702
msg->opt = htonl (options);
GNUNET_MQ_send (h->mq, env);
+=======
+ GNUNET_MQ_send (h->mq,
+ env);
+>>>>>>> removed GNUNET_CADET_ChannelOption
return ch;
}
if (NULL != target_id)
{
struct GNUNET_PeerIdentity pid;
- enum GNUNET_CADET_ChannelOption opt;
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (target_id,
"Connecting to `%s:%s'\n",
target_id,
target_port);
- opt = GNUNET_CADET_OPTION_DEFAULT | GNUNET_CADET_OPTION_RELIABLE;
GNUNET_CRYPTO_hash (target_port,
strlen(target_port),
&porthash);
NULL,
&pid,
&porthash,
- opt,
NULL /* window changes */,
&channel_ended,
handlers);
{
struct CadetChannel *ch = cls;
struct GNUNET_CADET_ChannelOpenMessage msgcc;
- uint32_t options;
ch->retry_control_task = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending CHANNEL_OPEN message for %s\n",
GCCH_2s (ch));
- options = 0;
- if (ch->nobuffer)
- options |= GNUNET_CADET_OPTION_NOBUFFER;
- if (ch->reliable)
- options |= GNUNET_CADET_OPTION_RELIABLE;
- if (ch->out_of_order)
- options |= GNUNET_CADET_OPTION_OUT_OF_ORDER;
msgcc.header.size = htons (sizeof (msgcc));
msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN);
- msgcc.opt = htonl (options);
msgcc.h_port = ch->h_port;
msgcc.ctn = ch->ctn;
ch->state = CADET_CHANNEL_OPEN_SENT;
ch = GNUNET_new (struct CadetChannel);
ch->mid_recv.mid = htonl (1); /* The OPEN_ACK counts as message 0! */
- ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER));
- ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE));
- ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER));
ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */
ch->owner = ccco;
ch->port = *port;
ch->t = t;
ch->ctn = ctn;
ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME;
- ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER));
- ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE));
- ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER));
ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */
GNUNET_STATISTICS_update (stats,
"# channels",
ch->retry_control_task = NULL;
}
options = 0;
- if (ch->nobuffer)
- options |= GNUNET_CADET_OPTION_NOBUFFER;
- if (ch->reliable)
- options |= GNUNET_CADET_OPTION_RELIABLE;
- if (ch->out_of_order)
- options |= GNUNET_CADET_OPTION_OUT_OF_ORDER;
cccd = GNUNET_new (struct CadetChannelClient);
GNUNET_assert (NULL == ch->dest);
ch->dest = cccd;
*/
enum CadetConnectionState state;
- /**
- * Options for the route, control buffering.
- */
- enum GNUNET_CADET_ChannelOption options;
-
/**
* How many latency observations did we make for this connection?
*/
env = GNUNET_MQ_msg_extra (create_msg,
(2 + cc->off) * 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 off offset of @a destination on @a 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
connection_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
unsigned int off,
- enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid,
enum CadetConnectionState init_state,
struct CadetPeer *first_hop;
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,
off,
- 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 off offset of @a destination on @a 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
GCC_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
unsigned int off,
- enum GNUNET_CADET_ChannelOption options,
struct CadetTConnection *ct,
GCC_ReadyCallback ready_cb,
void *ready_cb_cls)
return connection_create (destination,
path,
off,
- options,
ct,
&cid,
CADET_CONNECTION_NEW,
-
/*
This file is part of GNUnet.
Copyright (C) 2001-2017 GNUnet e.V.
* @param destination where to go
* @param path which path to take (may not be the full path)
* @param off offset of @a destination on @a 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
GCC_create (struct CadetPeer *destination,
struct CadetPeerPath *path,
unsigned int off,
- 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,
*/
struct GNUNET_CONTAINER_HeapNode *hn;
- /**
- * Options for the route, control buffering.
- */
- enum GNUNET_CADET_ChannelOption options;
+
};
GCP_2s (origin),
GNUNET_sh2s (&msg->cid.connection_of_tunnel));
path = GCPP_get_path_from_route (path_length - 1,
- pids);
+ pids);
if (GNUNET_OK !=
GCT_add_inbound_connection (GCP_get_tunnel (origin,
GNUNET_YES),
*
* @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);
uint32_t cn GNUNET_PACKED;
};
-
-/**
- * Channel options. Second line indicates filed in the
- * CadetChannelInfo union carrying the answer.
- *
- * @deprecated we should replace channel options with per-envelope
- * options, and then re-use the options from `enum GNUNET_MQ_PriorityPreferences`.
- */
-enum GNUNET_CADET_ChannelOption
-{
- /**
- * Default options: unreliable, default buffering, not out of order.
- */
- GNUNET_CADET_OPTION_DEFAULT = 0x0,
-
- /**
- * Disable buffering on intermediate nodes (for minimum latency).
- * Yes/No.
- */
- GNUNET_CADET_OPTION_NOBUFFER = 0x1,
-
- /**
- * Enable channel reliability, lost messages will be retransmitted.
- * Yes/No.
- */
- GNUNET_CADET_OPTION_RELIABLE = 0x2,
-
- /**
- * Enable out of order delivery of messages.
- * Set bit for out-of-order delivery.
- */
- GNUNET_CADET_OPTION_OUT_OF_ORDER = 0x4,
-
- /**
- * Who is the peer at the other end of the channel.
- * Only for use in @c GNUNET_CADET_channel_get_info
- * struct GNUNET_PeerIdentity *peer
- */
- GNUNET_CADET_OPTION_PEER = 0x8
-
-};
-
-
/**
* Method called whenever a peer connects to a port in MQ-based CADET.
*
* - Each message type callback in @a handlers
* @param destination Peer identity the channel should go to.
* @param port Identification of the destination port.
- * @param options CadetOption flag field, with all desired option bits set to 1.
* @param window_changes Function called when the transmit window size changes.
* Can be NULL if this data is of no interest.
* TODO Not yet implemented.
void *channel_cls,
const struct GNUNET_PeerIdentity *destination,
const struct GNUNET_HashCode *port,
- enum GNUNET_CADET_ChannelOption options,
GNUNET_CADET_WindowSizeEventHandler window_changes,
GNUNET_CADET_DisconnectEventHandler disconnects,
const struct GNUNET_MQ_MessageHandler *handlers);
* Get information about a channel.
*
* @param channel Channel handle.
- * @param option Query type GNUNET_CADET_OPTION_*
* @param ... dependant on option, currently not used
* @return Union with an answer to the query.
*/
const union GNUNET_CADET_ChannelInfo *
GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
- enum GNUNET_CADET_ChannelOption option,
...);