From 44d957c38051c6e778595b74f4a831da8ad1a179 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 5 Dec 2013 14:15:25 +0000 Subject: - change mesh channel creation/notification API --- src/conversation/gnunet-service-conversation.c | 6 +- src/exit/gnunet-daemon-exit.c | 3 +- src/fs/gnunet-service-fs_mesh_client.c | 6 +- src/fs/gnunet-service-fs_mesh_server.c | 3 +- src/include/gnunet_mesh_service.h | 19 +++++-- src/mesh/mesh_api.c | 65 ++++++--------------- src/mesh/test_mesh_local.c | 5 +- src/mesh/test_mesh_single.c | 6 +- src/mesh/test_mesh_small.c | 12 ++-- src/pt/gnunet-daemon-pt.c | 3 +- src/scalarproduct/gnunet-service-scalarproduct.c | 37 ++++++------ src/set/gnunet-service-set.c | 72 ++++++++++++------------ src/vpn/gnunet-service-vpn.c | 8 +-- 13 files changed, 111 insertions(+), 134 deletions(-) diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 38344f5ce..1a2f439b6 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -701,8 +701,7 @@ handle_client_call_message (void *cls, ch, &msg->target, GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, - GNUNET_NO, - GNUNET_YES); + GNUNET_MESH_OPTION_RELIABLE); ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable); e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING); ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); @@ -1073,8 +1072,7 @@ handle_mesh_pickup_message (void *cls, ch, &ch->target, GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, - GNUNET_YES, - GNUNET_NO); + GNUNET_MESH_OPTION_DEFAULT); if (NULL == ch->channel_unreliable) { GNUNET_break (0); diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 819e4f4b6..3bdac2d51 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -3008,13 +3008,14 @@ receive_udp_service (void *cls, * @param channel new handle to the channel * @param initiator peer that started the channel * @param port destination port + * @param options channel options flags * @return initial channel context for the channel */ static void * new_channel (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { struct ChannelState *s = GNUNET_new (struct ChannelState); diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c index 7bf6fb115..95e370274 100644 --- a/src/fs/gnunet-service-fs_mesh_client.c +++ b/src/fs/gnunet-service-fs_mesh_client.c @@ -228,8 +228,7 @@ reset_mesh (struct MeshHandle *mh) mh, &mh->target, GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, - GNUNET_NO, - GNUNET_YES); + GNUNET_MESH_OPTION_RELIABLE); transmit_pending (mh); } @@ -543,8 +542,7 @@ get_mesh (const struct GNUNET_PeerIdentity *target) mh, &mh->target, GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, - GNUNET_NO, - GNUNET_YES); + GNUNET_MESH_OPTION_RELIABLE); GNUNET_assert (mh == GNUNET_CONTAINER_multipeermap_get (mesh_map, target)); diff --git a/src/fs/gnunet-service-fs_mesh_server.c b/src/fs/gnunet-service-fs_mesh_server.c index 4e11221e4..fe2d43135 100644 --- a/src/fs/gnunet-service-fs_mesh_server.c +++ b/src/fs/gnunet-service-fs_mesh_server.c @@ -458,13 +458,14 @@ request_cb (void *cls, * @param initiator the identity of the peer who wants to establish a mesh * with us; NULL on binding error * @param port mesh port used for the incoming connection + * @param options channel option flags * @return initial channel context (our 'struct MeshClient') */ static void * accept_cb (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { struct MeshClient *sc; diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index d5d4e39d1..00894506e 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h @@ -61,6 +61,11 @@ struct GNUNET_MESH_Channel; */ enum MeshOption { + /** + * Default options: unreliable, default buffering, not out of order. + */ + GNUNET_MESH_OPTION_DEFAULT = 0x0, + /** * Disable buffering on intermediate nodes (for minimum latency). * Yes/No. @@ -81,6 +86,7 @@ enum MeshOption /** * Who is the peer at the other end of the channel. + * Only for use in @c GNUNET_MESH_channel_get_info * struct GNUNET_PeerIdentity *peer */ GNUNET_MESH_OPTION_PEER = 0x8 @@ -146,6 +152,8 @@ struct GNUNET_MESH_MessageHandler * @param channel new handle to the channel * @param initiator peer that started the channel * @param port Port this channel is for. + * @param options MeshOption flag field, with all active option bits set to 1. + * * @return initial channel context for the channel * (can be NULL -- that's not an error) */ @@ -156,7 +164,9 @@ typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls, const struct GNUNET_PeerIdentity * initiator, - uint32_t port); + uint32_t port, + enum MeshOption + options); /** @@ -229,8 +239,8 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); * @param channel_ctx client's channel context to associate with the channel * @param peer peer identity the channel should go to * @param port Port number. - * @param nobuffer Flag for disabling buffering on relay nodes. - * @param reliable Flag for end-to-end reliability. + * @param options MeshOption flag field, with all desired option bits set to 1. + * * @return handle to the channel */ struct GNUNET_MESH_Channel * @@ -238,8 +248,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, void *channel_ctx, const struct GNUNET_PeerIdentity *peer, uint32_t port, - int nobuffer, - int reliable); + enum MeshOption options); /** diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 0d1d70026..46dfe546f 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -277,19 +277,9 @@ struct GNUNET_MESH_Channel unsigned int packet_size; /** - * Is the channel allowed to buffer? + * Channel options: reliability, etc. */ - int nobuffer; - - /** - * Is the channel realiable? - */ - int reliable; - - /** - * If reliable, is the channel out of order? - */ - int ooorder; + enum MeshOption options; /** * Are we allowed to send to the service? @@ -439,7 +429,6 @@ create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) ch->chid = chid; } ch->allow_send = GNUNET_NO; - ch->nobuffer = GNUNET_NO; return ch; } @@ -782,24 +771,10 @@ process_channel_created (struct GNUNET_MESH_Handle *h, ch->mesh = h; ch->chid = chid; ch->port = port; - if (0 != (msg->opt & GNUNET_MESH_OPTION_NOBUFFER)) - ch->nobuffer = GNUNET_YES; - else - ch->nobuffer = GNUNET_NO; - - if (0 != (msg->opt & GNUNET_MESH_OPTION_RELIABLE)) - ch->reliable = GNUNET_YES; - else - ch->reliable = GNUNET_NO; - - if (GNUNET_YES == ch->reliable && - 0 != (msg->opt & GNUNET_MESH_OPTION_OOORDER)) - ch->ooorder = GNUNET_YES; - else - ch->ooorder = GNUNET_NO; + ch->options = ntohl (msg->opt); LOG (GNUNET_ERROR_TYPE_DEBUG, " created channel %p\n", ch); - ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port); + ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port, ch->options); if (NULL != ctx) ch->ctx = ctx; LOG (GNUNET_ERROR_TYPE_DEBUG, "User notified\n"); @@ -1398,18 +1373,16 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) * @param channel_ctx client's channel context to associate with the channel * @param peer peer identity the channel should go to * @param port Port number. - * @param nobuffer Flag for disabling buffering on relay nodes. - * @param reliable Flag for end-to-end reliability. + * @param options MeshOption flag field, with all desired option bits set to 1. * * @return handle to the channel */ struct GNUNET_MESH_Channel * GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, - void *channel_ctx, - const struct GNUNET_PeerIdentity *peer, - uint32_t port, - int nobuffer, - int reliable) + void *channel_ctx, + const struct GNUNET_PeerIdentity *peer, + uint32_t port, + enum MeshOption options) { struct GNUNET_MESH_Channel *ch; struct GNUNET_MESH_ChannelMessage msg; @@ -1427,12 +1400,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, msg.channel_id = htonl (ch->chid); msg.port = htonl (port); msg.peer = *peer; - msg.opt = 0; - if (GNUNET_YES == reliable) - msg.opt |= GNUNET_MESH_OPTION_RELIABLE; - if (GNUNET_YES == nobuffer) - msg.opt |= GNUNET_MESH_OPTION_NOBUFFER; - msg.opt = htonl (msg.opt); + msg.opt = htonl (options); ch->allow_send = 0; send_packet (h, &msg.header, ch); return ch; @@ -1489,20 +1457,21 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) */ const union GNUNET_MESH_ChannelInfo * GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, - enum MeshOption option, ...) + enum MeshOption option, ...) { + static int bool_flag; const union GNUNET_MESH_ChannelInfo *ret; switch (option) { case GNUNET_MESH_OPTION_NOBUFFER: - ret = (const union GNUNET_MESH_ChannelInfo *) &channel->nobuffer; - break; case GNUNET_MESH_OPTION_RELIABLE: - ret = (const union GNUNET_MESH_ChannelInfo *) &channel->reliable; - break; case GNUNET_MESH_OPTION_OOORDER: - ret = (const union GNUNET_MESH_ChannelInfo *) &channel->ooorder; + if (0 != (option & channel->options)) + bool_flag = GNUNET_YES; + else + bool_flag = GNUNET_NO; + ret = (const union GNUNET_MESH_ChannelInfo *) &bool_flag; break; case GNUNET_MESH_OPTION_PEER: ret = (const union GNUNET_MESH_ChannelInfo *) GNUNET_PEER_resolve2 (channel->peer); diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c index bdd603351..35a16b0d9 100644 --- a/src/mesh/test_mesh_local.c +++ b/src/mesh/test_mesh_local.c @@ -141,13 +141,14 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel, * @param channel new handle to the channel * @param initiator peer that started the channel * @param port port number + * @param options channel options * @return initial channel context for the channel * (can be NULL -- that's not an error) */ static void * inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { long id = (long) cls; @@ -256,7 +257,7 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TESTING_peer_get_identity (me, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1, - GNUNET_YES, GNUNET_NO); + GNUNET_MESH_OPTION_DEFAULT); mth = GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, sizeof (struct GNUNET_MessageHeader), diff --git a/src/mesh/test_mesh_single.c b/src/mesh/test_mesh_single.c index 15e8a1dbd..689139b82 100644 --- a/src/mesh/test_mesh_single.c +++ b/src/mesh/test_mesh_single.c @@ -162,13 +162,14 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel, * @param channel new handle to the channel * @param initiator peer that started the channel * @param port port number + * @param options channel option flags * @return initial channel context for the channel * (can be NULL -- that's not an error) */ static void * inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "received incoming channel on port %u\n", @@ -256,7 +257,8 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TESTING_peer_get_identity (me, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); - ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1, GNUNET_YES, GNUNET_NO); + ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1, + GNUNET_MESH_OPTION_DEFAULT); GNUNET_MESH_notify_transmit_ready (ch1, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, size, &do_send, NULL); diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index 49e394f03..e63e343cf 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c @@ -536,13 +536,14 @@ static struct GNUNET_MESH_MessageHandler handlers[] = { * @param channel New handle to the channel. * @param initiator Peer that started the channel. * @param port Port this channel is connected to. + * @param options channel option flags * @return Initial channel context for the channel * (can be NULL -- that's not an error). */ static void * incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Incoming channel from %s to peer %d\n", @@ -629,7 +630,7 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, static void do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - int rel; + enum MeshOption flags; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n"); @@ -641,14 +642,13 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_SCHEDULER_cancel (disconnect_task); } + flags = GNUNET_MESH_OPTION_DEFAULT; if (SPEED_REL == test) { test = SPEED; - rel = GNUNET_YES; + flags |= GNUNET_MESH_OPTION_RELIABLE; } - else - rel = GNUNET_NO; - ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, GNUNET_NO, rel); + ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, flags); disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index 6375406d9..166f9df1d 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c @@ -352,8 +352,7 @@ try_open_exit () pos, &pos->peer, GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, - GNUNET_YES /* no buffer */, - GNUNET_NO /* reliable */); + GNUNET_MESH_OPTION_DEFAULT); if (NULL == pos->mesh_channel) { GNUNET_break (0); diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index b6c8e6077..5a917b20c 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c @@ -226,9 +226,9 @@ struct ServiceSession * Send a multi part chunk of a service request from alice to bob. * This element only contains a part of the elements-vector (session->a[]), * mask and public key set have to be contained within the first message - * + * * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. - * + * * @param cls the associated service session */ static void @@ -237,7 +237,7 @@ prepare_service_request_multipart (void *cls); /** * Send a multi part chunk of a service response from bob to alice. * This element only contains the two permutations of R, R'. - * + * * @param cls the associated service session */ static void @@ -657,7 +657,7 @@ permute_vector (gcry_mpi_t * vector, /** * Finds a not terminated client/service session in the * given DLL based on session key, element count and state. - * + * * @param tail - the tail of the DLL * @param key - the key we want to search for * @param element_count - the total element count of the dataset (session->total) @@ -694,7 +694,7 @@ find_matching_session (struct ServiceSession * tail, /** * Safely frees ALL memory areas referenced by a session. - * + * * @param session - the session to free elements from */ static void @@ -769,7 +769,7 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) { struct ServiceSession *session; - + if (NULL != client) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Client (%p) disconnected from us.\n"), client); @@ -851,7 +851,7 @@ prepare_client_end_notification (void * cls, } else GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Sending session-end notification to client (%p) for session %s\n"), &session->client, GNUNET_h2s (&session->key)); - + free_session_variables (session); } @@ -953,7 +953,7 @@ prepare_client_response (void *cls, /** * Send a multipart chunk of a service response from bob to alice. * This element only contains the two permutations of R, R'. - * + * * @param cls the associated service session */ static void @@ -1396,9 +1396,9 @@ except: * Send a multi part chunk of a service request from alice to bob. * This element only contains a part of the elements-vector (session->a[]), * mask and public key set have to be contained within the first message - * + * * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. - * + * * @param cls the associated service session */ static void @@ -1751,8 +1751,7 @@ handle_client_request (void *cls, session->channel = GNUNET_MESH_channel_create (my_mesh, session, &session->peer, GNUNET_APPLICATION_TYPE_SCALARPRODUCT, - GNUNET_NO, - GNUNET_YES); + GNUNET_MESH_OPTION_RELIABLE); //prepare_service_request, channel_peer_disconnect_handler, if (!session->channel) { GNUNET_break (0); @@ -1815,18 +1814,20 @@ handle_client_request (void *cls, * @param channel new handle to the channel * @param initiator peer that started the channel * @param port unused + * @param options unused + * * @return session associated with the channel */ static void * channel_incoming_handler (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { struct ServiceSession * c = GNUNET_new (struct ServiceSession); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("New incoming channel from peer %s.\n"), GNUNET_i2s (initiator)); - + c->peer = *initiator; c->channel = channel; c->role = BOB; @@ -1861,7 +1862,7 @@ channel_destruction_handler (void *cls, GNUNET_i2s (&session->peer)); if (ALICE == session->role) { // as we have only one peer connected in each session, just remove the session - + if ((SERVICE_RESPONSE_RECEIVED > session->state) && (!do_shutdown)) { session->channel = NULL; // if this happened before we received the answer, we must terminate the session @@ -2288,7 +2289,7 @@ handle_service_response_multipart (void *cls, return GNUNET_OK; session->state = SERVICE_RESPONSE_RECEIVED; session->product = compute_scalar_product (session); //never NULL - + invalid_msg: GNUNET_break_op (NULL != session->product); @@ -2342,7 +2343,7 @@ handle_service_response (void *cls, //we need at least a full message without elements attached msg_size = ntohs (msg->header.size); required_size = sizeof (struct GNUNET_SCALARPRODUCT_service_response) + 2 * PAILLIER_ELEMENT_LENGTH; - + if (required_size > msg_size) { goto invalid_msg; } @@ -2393,7 +2394,7 @@ handle_service_response (void *cls, session->state = SERVICE_RESPONSE_RECEIVED; session->product = compute_scalar_product (session); //never NULL - + invalid_msg: GNUNET_break_op (NULL != session->product); // send message with product to client diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 749154010..27c8d3bc0 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c @@ -237,7 +237,7 @@ listener_destroy (struct Listener *listener) * Collect and destroy elements that are not needed anymore, because * their lifetime (as determined by their generation) does not overlap with any active * set operation. - * + * * We hereby replace the old element hashmap with a new one, instead of removing elements. */ void @@ -252,7 +252,7 @@ collect_generation_garbage (struct Set *set) new_elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements); while (GNUNET_OK == - (res = GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ee))) + (res = GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ee))) { if (GNUNET_NO == ee->removed) goto still_needed; @@ -449,7 +449,7 @@ incoming_destroy (struct Operation *incoming) /** * remove & free state of the operation from the incoming list - * + * * @param incoming the element to remove */ @@ -510,7 +510,7 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task); GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; - + mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, incoming->spec->context_msg); GNUNET_assert (NULL != mqm); @@ -524,9 +524,9 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) /** * Handle a request for a set operation from - * another peer. - * - * This msg is expected as the first and only msg handled through the + * another peer. + * + * This msg is expected as the first and only msg handled through the * non-operation bound virtual table, acceptance of this operation replaces * our virtual table and subsequent msgs would be routed differently. * @@ -685,7 +685,7 @@ handle_client_create_set (void *cls, ntohs (msg->operation)); // max. one set per client! - if (NULL != set_get (client)) + if (NULL != set_get (client)) { GNUNET_break (0); GNUNET_SERVER_client_disconnect (client); @@ -742,7 +742,7 @@ handle_client_listen (void *cls, GNUNET_SERVER_client_disconnect (client); return; } - + listener = GNUNET_new (struct Listener); listener->client = client; listener->client_mq = GNUNET_MQ_queue_for_server_client (client); @@ -751,7 +751,7 @@ handle_client_listen (void *cls, GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new listener created (op %u, app %s)\n", listener->operation, GNUNET_h2s (&listener->app_id)); - + /* check for incoming requests the listener is interested in */ for (op = incoming_head; NULL != op; op = op->next) { @@ -805,7 +805,7 @@ handle_client_reject (void *cls, return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer request rejected by client\n"); - + GNUNET_MESH_channel_destroy (incoming->channel); //channel destruction handler called immediately upon destruction GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -925,7 +925,7 @@ handle_client_evaluate (void *cls, spec->result_mode = ntohs (msg->result_mode); spec->client_request_id = ntohl (msg->request_id); spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); - + // for simplicity we just backup the context msg instead of rebuilding it later on if (NULL != spec->context_msg) spec->context_msg = GNUNET_copy_message (spec->context_msg); @@ -938,8 +938,7 @@ handle_client_evaluate (void *cls, op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer, GNUNET_APPLICATION_TYPE_SET, - GNUNET_YES, - GNUNET_YES); + GNUNET_MESH_OPTION_RELIABLE); op->mq = GNUNET_MESH_mq_create (op->channel); @@ -950,7 +949,7 @@ handle_client_evaluate (void *cls, /** * Handle an ack from a client, and send the next element. - * + * * @param cls unused * @param client the client * @param m the message @@ -1027,7 +1026,7 @@ handle_client_cancel (void *cls, GNUNET_SERVER_client_disconnect (client); return; } - + _GSS_operation_destroy (op); } @@ -1036,7 +1035,7 @@ handle_client_cancel (void *cls, * Handle a request from the client to accept * a set operation that came from a remote peer. * We forward the accept to the associated operation for handling - * + * * @param cls unused * @param client the client * @param mh the message @@ -1066,7 +1065,7 @@ handle_client_accept (void *cls, // client without a set requested an operation set = set_get (client); - + if (NULL == set) { GNUNET_break (0); @@ -1126,7 +1125,7 @@ shutdown_task (void *cls, /** * Timeout happens iff: - * - we suggested an operation to our listener, + * - we suggested an operation to our listener, * but did not receive a response in time * - we got the channel from a peer but no GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST * - shutdown (obviously) @@ -1152,14 +1151,14 @@ incoming_timeout_cb (void *cls, /** * Terminates an incoming operation in case we have not yet received an * operation request. Called by the channel destruction handler. - * + * * @param op the channel context */ static void handle_incoming_disconnect (struct Operation *op) { GNUNET_assert (GNUNET_YES == op->is_incoming); - + if (NULL == op->channel) return; @@ -1171,16 +1170,17 @@ handle_incoming_disconnect (struct Operation *op) * Method called whenever another peer has added us to a channel * the other peer initiated. * Only called (once) upon reception of data with a message type which was - * subscribed to in GNUNET_MESH_connect. - * + * subscribed to in GNUNET_MESH_connect. + * * The channel context represents the operation itself and gets added to a DLL, - * from where it gets looked up when our local listener client responds + * from where it gets looked up when our local listener client responds * to a proposed/suggested operation or connects and associates with this operation. * * @param cls closure * @param channel new handle to the channel * @param initiator peer that started the channel * @param port Port this channel is for. + * @param options Unused. * @return initial channel context for the channel * (can be NULL -- that's not an error) */ @@ -1188,7 +1188,7 @@ static void * channel_new_cb (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port) + uint32_t port, enum MeshOption options) { struct Operation *incoming; static const struct SetVT incoming_vt = { @@ -1202,7 +1202,7 @@ channel_new_cb (void *cls, { GNUNET_break (0); GNUNET_MESH_channel_destroy (channel); - return; + return NULL; } incoming = GNUNET_new (struct Operation); @@ -1225,12 +1225,12 @@ channel_new_cb (void *cls, * any associated state. * GNUNET_MESH_channel_destroy. It must NOT call GNUNET_MESH_channel_destroy on * the channel. - * - * The peer_disconnect function is part of a a virtual table set initially either + * + * The peer_disconnect function is part of a a virtual table set initially either * when a peer creates a new channel with us (channel_new_cb), or once we create - * a new channel ourselves (evaluate). - * - * Once we know the exact type of operation (union/intersection), the vt is + * a new channel ourselves (evaluate). + * + * Once we know the exact type of operation (union/intersection), the vt is * replaced with an operation specific instance (_GSS_[op]_vt). * * @param cls closure (set from GNUNET_MESH_connect) @@ -1259,11 +1259,11 @@ channel_end_cb (void *cls, * Functions with this signature are called whenever any message is * received via the mesh channel. * - * The msg_handler is a virtual table set in initially either when a peer - * creates a new channel with us (channel_new_cb), or once we create a new channel - * ourselves (evaluate). - * - * Once we know the exact type of operation (union/intersection), the vt is + * The msg_handler is a virtual table set in initially either when a peer + * creates a new channel with us (channel_new_cb), or once we create a new channel + * ourselves (evaluate). + * + * Once we know the exact type of operation (union/intersection), the vt is * replaced with an operation specific instance (_GSS_[op]_vt). * * @param cls Closure (set from GNUNET_MESH_connect). diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index eebdcac55..16e84e715 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -731,8 +731,7 @@ handle_regex_result (void *cls, ts, id, apptype, - GNUNET_YES, - GNUNET_NO); + GNUNET_MESH_OPTION_DEFAULT); } @@ -778,8 +777,7 @@ create_channel_to_destination (struct DestinationChannel *dt, ts, &dt->destination->details.service_destination.target, apptype, - GNUNET_YES, - GNUNET_NO); + GNUNET_MESH_OPTION_DEFAULT); if (NULL == ts->channel) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -815,7 +813,7 @@ create_channel_to_destination (struct DestinationChannel *dt, char address[GNUNET_TUN_IPV6_REGEXLEN]; GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, - dt->destination_port, + dt->destination_port, address); GNUNET_asprintf (&policy, "%s%s", GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, -- cgit v1.2.3