ch->channel_reliable = GNUNET_CADET_channel_create (cadet,
ch,
&msg->target,
- GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
+ GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL),
GNUNET_CADET_OPTION_RELIABLE);
ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
ch->channel_unreliable = GNUNET_CADET_channel_create (cadet,
ch,
&ch->target,
- GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
+ GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO),
GNUNET_CADET_OPTION_DEFAULT);
if (NULL == ch->channel_unreliable)
{
*/
static void *
inbound_channel (void *cls,
- struct GNUNET_CADET_Channel *channel,
- const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_CADET_ChannelOption options)
+ struct GNUNET_CADET_Channel *channel,
+ const struct GNUNET_PeerIdentity *initiator,
+ const struct GNUNET_HashCode *port,
+ enum GNUNET_CADET_ChannelOption options)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Received incoming Cadet channel on port %u\n"),
- (unsigned int) port);
+ _("Received incoming Cadet channel on port %s\n"),
+ GNUNET_h2s (port));
return NULL;
}
0},
{NULL, 0, 0}
};
- static uint32_t ports[] = {
- GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
- GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
- 0
- };
cfg = c;
GNUNET_assert (GNUNET_OK ==
&my_identity));
cadet = GNUNET_CADET_connect (cfg,
NULL,
- &inbound_channel,
&inbound_end,
- cadet_handlers,
- ports);
+ cadet_handlers);
if (NULL == cadet)
{
GNUNET_SCHEDULER_shutdown ();
return;
}
+
+ GNUNET_CADET_open_port (cadet,
+ GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL),
+ &inbound_channel, NULL);
+ GNUNET_CADET_open_port (cadet,
+ GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO),
+ &inbound_channel, NULL);
+
nc = GNUNET_SERVER_notification_context_create (server, 16);
GNUNET_SERVER_add_handlers (server, server_handlers);
GNUNET_SERVER_disconnect_notify (server,
new_channel (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
struct ChannelState *s = GNUNET_new (struct ChannelState);
GNUNET_SCHEDULER_shutdown ();
return;
}
- cadet_handle
- = GNUNET_CADET_connect (cfg, NULL,
- &new_channel,
- &clean_channel, handlers,
- apptypes);
+ cadet_handle = GNUNET_CADET_connect (cfg, NULL, &clean_channel, handlers);
if (NULL == cadet_handle)
{
GNUNET_SCHEDULER_shutdown ();
return;
}
+ for (int i = 0;
+ GNUNET_APPLICATION_TYPE_END != apptypes[i]
+ && i < sizeof (apptypes)/sizeof (*apptypes);
+ i++)
+ {
+ GNUNET_CADET_open_port (cadet_handle, GC_u2h (apptypes[i]),
+ &new_channel, NULL);
+ }
/* Cadet handle acquired, now announce regular expressions matching our exit */
if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )
mh->channel = GNUNET_CADET_channel_create (cadet_handle,
mh,
&mh->target,
- GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+ GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
GNUNET_CADET_OPTION_RELIABLE);
transmit_pending (mh);
}
mh->channel = GNUNET_CADET_channel_create (cadet_handle,
mh,
&mh->target,
- GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+ GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
GNUNET_CADET_OPTION_RELIABLE);
GNUNET_assert (mh ==
GNUNET_CONTAINER_multipeermap_get (cadet_map,
cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
cadet_handle = GNUNET_CADET_connect (GSF_cfg,
- NULL,
NULL,
&cleaner_cb,
- handlers,
- NULL);
+ handlers);
}
accept_cb (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_CADET_ChannelOption options)
+ const struct GNUNET_HashCode *port,
+ enum GNUNET_CADET_ChannelOption options)
{
struct CadetClient *sc;
{ &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct CadetQueryMessage)},
{ NULL, 0, 0 }
};
- static const uint32_t ports[] = {
- GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
- 0
- };
-
if (GNUNET_YES !=
GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
"fs",
"Initializing cadet FS server with a limit of %llu connections\n",
sc_count_max);
listen_channel = GNUNET_CADET_connect (GSF_cfg,
- NULL,
- &accept_cb,
- &cleaner_cb,
- handlers,
- ports);
+ NULL,
+ &cleaner_cb,
+ handlers);
+ GNUNET_assert (NULL != listen_channel);
+ GNUNET_CADET_open_port (listen_channel,
+ GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
+ &accept_cb, NULL);
}
chn->direction = DIR_OUTGOING;
chn->join_status = JOIN_WAITING;
chn->channel = GNUNET_CADET_channel_create (cadet, chn, &chn->peer,
- GNUNET_APPLICATION_TYPE_MULTICAST,
+ GC_u2h (GNUNET_APPLICATION_TYPE_MULTICAST),
GNUNET_CADET_OPTION_RELIABLE);
GNUNET_CONTAINER_multihashmap_put (channels_out, &chn->group_pub_hash, chn,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
cadet_notify_channel_new (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
return NULL;
};
-/**
- * Listening ports for CADET.
- */
-static const uint32_t cadet_ports[] = { GNUNET_APPLICATION_TYPE_MULTICAST, 0 };
-
-
/**
* Connected to core service.
*/
replay_req_client = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
cadet = GNUNET_CADET_connect (cfg, NULL,
- &cadet_notify_channel_new,
&cadet_notify_channel_end,
- cadet_handlers, cadet_ports);
+ cadet_handlers);
+ GNUNET_assert (NULL != cadet);
+ GNUNET_CADET_open_port (cadet, GC_u2h (GNUNET_APPLICATION_TYPE_MULTICAST),
+ &cadet_notify_channel_new, NULL);
nc = GNUNET_SERVER_notification_context_create (server, 1);
GNUNET_SERVER_add_handlers (server, server_handlers);
pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle,
pos,
&pos->peer,
- GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
+ GC_u2h (GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER),
GNUNET_CADET_OPTION_DEFAULT);
if (NULL == pos->cadet_channel)
{
GNUNET_SCHEDULER_shutdown ();
return;
}
- cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL,
+ cadet_handle = GNUNET_CADET_connect (cfg, NULL,
&cadet_channel_end_cb,
- cadet_handlers, NULL);
+ cadet_handlers);
if (NULL == cadet_handle)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
{&handle_peer_pull_reply , GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY , 0},
{NULL, 0, 0}
};
- const uint32_t ports[] = {GNUNET_RPS_CADET_PORT, 0}; // _PORT specified in src/rps/rps.h
cadet_handle = GNUNET_CADET_connect (cfg,
cls,
- &Peers_handle_inbound_channel,
&cleanup_destroyed_channel,
- cadet_handlers,
- ports);
+ cadet_handlers);
+ GNUNET_assert (NULL != cadet_handle);
+ GNUNET_CADET_open_port (cadet_handle, GC_u2h (GNUNET_RPS_CADET_PORT),
+ &Peers_handle_inbound_channel, cls);
+
peerinfo_handle = GNUNET_PEERINFO_connect (cfg);
Peers_initialise (fn_valid_peers, cadet_handle, &own_identity);
* Identity of the peer
*/
struct GNUNET_PeerIdentity peer_id;
-
+
/**
* Flags indicating status of peer
*/
GNUNET_CADET_channel_create (cadet_handle,
peer_ctx->send_channel_flags, /* context */
peer,
- GNUNET_RPS_CADET_PORT,
+ GC_u2h (GNUNET_RPS_CADET_PORT),
GNUNET_CADET_OPTION_RELIABLE);
}
GNUNET_assert (NULL != peer_ctx->send_channel);
*
* If we already have a message queue open to this client,
* simply return it, otherways create one.
- *
+ *
* @param peer the peer to get the mq to
* @return the #GNUNET_MQ_Handle
*/
// TODO actually remove unnecessary data
- if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
+ if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
{
return GNUNET_NO;
}
/**
* @brief Remove peer
- *
+ *
* @param peer the peer to clean
* @return #GNUNET_YES if peer was removed
* #GNUNET_NO otherwise
{
struct PeerContext *peer_ctx;
- if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
+ if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
{
return GNUNET_NO;
}
Peers_handle_inbound_channel (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
struct PeerContext *peer_ctx;
/**
* @brief Remove unecessary data
- *
+ *
* If the other peer is not intending to send messages, we have messages pending
* to be sent to this peer and we are not waiting for a reply, remove the
* information about it (its #PeerContext).
/**
* @brief Remove peer
- *
+ *
* @param peer the peer to clean
* @return #GNUNET_YES if peer was removed
* #GNUNET_NO otherwise
Peers_handle_inbound_channel (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options);
/**
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
- GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
&handle_client_disconnect,
NULL);
my_cadet = GNUNET_CADET_connect (cfg, NULL,
- NULL /* no incoming supported */,
&cb_channel_destruction,
- cadet_handlers,
- NULL);
+ cadet_handlers);
if (NULL == my_cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
cb_channel_incoming (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
struct CadetIncomingSession *in;
0},
{ NULL, 0, 0}
};
- static const uint32_t ports[] = {
- GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC,
- 0
- };
cfg = c;
/* We don't really do DLOG, so we can setup with very minimal resources */
cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128,
GNUNET_YES);
my_cadet = GNUNET_CADET_connect (cfg, NULL,
- &cb_channel_incoming,
&cb_channel_destruction,
- cadet_handlers,
- ports);
+ cadet_handlers);
if (NULL == my_cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ GNUNET_CADET_open_port (my_cadet,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
+ &cb_channel_incoming, NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
- GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
&handle_client_disconnect,
NULL);
my_cadet = GNUNET_CADET_connect (cfg, NULL,
- NULL /* no incoming supported */,
&cb_channel_destruction,
- cadet_handlers,
- NULL);
+ cadet_handlers);
if (NULL == my_cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
cb_channel_incoming (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
struct CadetIncomingSession *in;
0},
{ NULL, 0, 0}
};
- static const uint32_t ports[] = {
- GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
- 0
- };
cfg = c;
/*
cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128,
GNUNET_YES);
my_cadet = GNUNET_CADET_connect (cfg, NULL,
- &cb_channel_incoming,
&cb_channel_destruction,
- cadet_handlers,
- ports);
+ cadet_handlers);
if (NULL == my_cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
GNUNET_SCHEDULER_shutdown ();
return;
}
+ GNUNET_CADET_open_port (my_cadet,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
+ &cb_channel_incoming, NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
op->channel = GNUNET_CADET_channel_create (cadet,
op,
&msg->target_peer,
- GNUNET_APPLICATION_TYPE_SET,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SET),
GNUNET_CADET_OPTION_RELIABLE);
op->mq = GNUNET_CADET_mq_create (op->channel);
set->vt->evaluate (op,
channel_new_cb (void *cls,
struct GNUNET_CADET_Channel *channel,
const struct GNUNET_PeerIdentity *initiator,
- uint32_t port,
+ const struct GNUNET_HashCode *port,
enum GNUNET_CADET_ChannelOption options)
{
static const struct SetVT incoming_vt = {
};
struct Operation *incoming;
- if (GNUNET_APPLICATION_TYPE_SET != port)
+ if (0 != memcmp (GC_u2h (GNUNET_APPLICATION_TYPE_SET), port, sizeof (*port)))
{
GNUNET_break (0);
GNUNET_CADET_channel_destroy (channel);
{ &dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE, 0},
{NULL, 0, 0}
};
- static const uint32_t cadet_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
configuration = cfg;
GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
server_handlers);
_GSS_statistics = GNUNET_STATISTICS_create ("set", cfg);
cadet = GNUNET_CADET_connect (cfg, NULL,
- &channel_new_cb,
&channel_end_cb,
- cadet_handlers,
- cadet_ports);
+ cadet_handlers);
+ GNUNET_CADET_open_port (cadet,
+ GC_u2h (GNUNET_APPLICATION_TYPE_SET),
+ &channel_new_cb, NULL);
if (NULL == cadet)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
ts->channel = GNUNET_CADET_channel_create (cadet_handle,
ts,
id,
- apptype,
+ GC_u2h (apptype),
GNUNET_CADET_OPTION_DEFAULT);
}
ts->channel = GNUNET_CADET_channel_create (cadet_handle,
ts,
&dt->destination->details.service_destination.target,
- apptype,
+ GC_u2h (apptype),
GNUNET_CADET_OPTION_DEFAULT);
if (NULL == ts->channel)
{
cadet_handle =
GNUNET_CADET_connect (cfg_, NULL,
- NULL,
&channel_cleaner,
- cadet_handlers,
- NULL);
+ cadet_handlers);
+ // FIXME never opens ports???
helper_handle = GNUNET_HELPER_start (GNUNET_NO,
"gnunet-helper-vpn", vpn_argv,
&message_token, NULL, NULL);