- fix CADET-using services
authorBart Polot <bart@net.in.tum.de>
Wed, 20 Jul 2016 17:13:26 +0000 (17:13 +0000)
committerBart Polot <bart@net.in.tum.de>
Wed, 20 Jul 2016 17:13:26 +0000 (17:13 +0000)
15 files changed:
src/conversation/gnunet-service-conversation.c
src/exit/gnunet-daemon-exit.c
src/fs/gnunet-service-fs_cadet_client.c
src/fs/gnunet-service-fs_cadet_server.c
src/multicast/gnunet-service-multicast.c
src/pt/gnunet-daemon-pt.c
src/rps/gnunet-service-rps.c
src/rps/gnunet-service-rps_peers.c
src/rps/gnunet-service-rps_peers.h
src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
src/scalarproduct/gnunet-service-scalarproduct_alice.c
src/scalarproduct/gnunet-service-scalarproduct_bob.c
src/set/gnunet-service-set.c
src/vpn/gnunet-service-vpn.c

index dcef0f18b66c258a7e80e49c220671650491b419..b547d814c3b908b6e60d3dd7491b2951973fa464 100644 (file)
@@ -720,7 +720,7 @@ handle_client_call_message (void *cls,
   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);
@@ -1102,7 +1102,7 @@ handle_cadet_pickup_message (void *cls,
   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)
   {
@@ -1351,13 +1351,14 @@ handle_cadet_audio_message (void *cls,
  */
 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;
 }
 
@@ -1557,11 +1558,6 @@ run (void *cls,
      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 ==
@@ -1569,10 +1565,8 @@ run (void *cls,
                                                   &my_identity));
   cadet = GNUNET_CADET_connect (cfg,
                              NULL,
-                             &inbound_channel,
                              &inbound_end,
-                              cadet_handlers,
-                              ports);
+                              cadet_handlers);
 
   if (NULL == cadet)
   {
@@ -1580,6 +1574,14 @@ run (void *cls,
     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,
index 9f3d05c77bf97222d365dc998fac1be2443592e9..2b9ddc722aef6a93466d3aa3726ca41145ca800e 100644 (file)
@@ -3036,7 +3036,7 @@ static void *
 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);
@@ -3760,16 +3760,20 @@ run (void *cls,
     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) )
index 90a0c3b7ff64a4303b21b6a854b89e6ba8292f14..5b24b3116030e23ef28c13d02c31ffa53be5f7ee 100644 (file)
@@ -236,7 +236,7 @@ reset_cadet (struct CadetHandle *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);
   transmit_pending (mh);
 }
@@ -547,7 +547,7 @@ get_cadet (const struct GNUNET_PeerIdentity *target)
   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,
@@ -718,11 +718,9 @@ GSF_cadet_start_client ()
 
   cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
   cadet_handle = GNUNET_CADET_connect (GSF_cfg,
-                                    NULL,
                                     NULL,
                                     &cleaner_cb,
-                                    handlers,
-                                    NULL);
+                                    handlers);
 }
 
 
index 21874b674ad0ac482f1f303071be36ade4112a0a..32fe4191a1877a6799d7c764341f94f77844cc84 100644 (file)
@@ -472,7 +472,8 @@ static void *
 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;
 
@@ -561,11 +562,6 @@ GSF_cadet_start_server ()
     { &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",
@@ -576,11 +572,13 @@ GSF_cadet_start_server ()
              "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);
 }
 
 
index 55c2698741364deaa9b87afc5fbbd4fab48a7f17..91cafb707421daf85ad402bb137bc111fcc59780 100644 (file)
@@ -789,7 +789,7 @@ cadet_channel_create (struct Group *grp, struct GNUNET_PeerIdentity *peer)
   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);
@@ -1484,7 +1484,7 @@ static void *
 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;
@@ -1809,12 +1809,6 @@ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
 };
 
 
-/**
- * Listening ports for CADET.
- */
-static const uint32_t cadet_ports[] = { GNUNET_APPLICATION_TYPE_MULTICAST, 0 };
-
-
 /**
  * Connected to core service.
  */
@@ -1833,9 +1827,11 @@ core_connected_cb  (void *cls, const struct GNUNET_PeerIdentity *my_identity)
   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);
index 5d83fd883eb83556eefa2680da186a1a75a5c8d1..7f4852e4b6472fa0130505fa354a1cd63c4f7829 100644 (file)
@@ -351,7 +351,7 @@ try_open_exit ()
        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)
        {
@@ -1288,9 +1288,9 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       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,
index bb2bd088192a4901c54068753bb7b330010931b5..00c541d1fe2ec618d602f20e43e8ecf5141622bb 100644 (file)
@@ -2334,13 +2334,14 @@ run (void *cls,
     {&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);
index 2b5f39857f5931e62ed371e053874aeb5822b3fc..7c9f5ecd93dae4d6a6364a07c95a586ceba8a0a0 100644 (file)
@@ -174,7 +174,7 @@ struct PeerContext
    * Identity of the peer
    */
   struct GNUNET_PeerIdentity peer_id;
-  
+
   /**
    * Flags indicating status of peer
    */
@@ -506,7 +506,7 @@ get_channel (const struct GNUNET_PeerIdentity *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);
@@ -518,7 +518,7 @@ get_channel (const struct GNUNET_PeerIdentity *peer)
  *
  * 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
  */
@@ -1086,7 +1086,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer)
 
   // 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;
   }
@@ -1104,7 +1104,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer)
 
 /**
  * @brief Remove peer
- * 
+ *
  * @param peer the peer to clean
  * @return #GNUNET_YES if peer was removed
  *         #GNUNET_NO  otherwise
@@ -1114,7 +1114,7 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
 {
   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;
   }
@@ -1350,7 +1350,7 @@ void *
 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;
index abb5d831a7ab0d7266a3e54b6ac7f10fedef308d..c7b9ed265f3a7d73bac7fec3fbe292a2653bf6a6 100644 (file)
@@ -173,7 +173,7 @@ Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer);
 
 /**
  * @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).
@@ -187,7 +187,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer);
 
 /**
  * @brief Remove peer
- * 
+ *
  * @param peer the peer to clean
  * @return #GNUNET_YES if peer was removed
  *         #GNUNET_NO  otherwise
@@ -320,7 +320,7 @@ void *
 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);
 
 /**
index c9f4811e2f079cd2b811680157fbf269676f594e..43a25a08d4e6b738c3ca2672f908f357617289a7 100644 (file)
@@ -858,7 +858,7 @@ client_request_complete_alice (struct AliceServiceSession *s)
     = 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)
   {
@@ -1184,10 +1184,8 @@ run (void *cls,
                                    &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,
index fbdf62192a15adb66619f356b77787b269d6855a..7246fa6a034284548f3d6dbf975821dd4865dcd4 100644 (file)
@@ -891,7 +891,7 @@ static void *
 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;
@@ -1221,10 +1221,6 @@ run (void *cls,
       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 */
@@ -1241,10 +1237,8 @@ run (void *cls,
   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,
@@ -1252,6 +1246,9 @@ run (void *cls,
     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);
 }
index 5478a85a73e0922c28942d32239c835eae14a8f4..8c3b1ed24f7121ca5f5c6f80107c2367cc958c2b 100644 (file)
@@ -1081,7 +1081,7 @@ client_request_complete_alice (struct AliceServiceSession *s)
     = 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)
   {
@@ -1409,10 +1409,8 @@ run (void *cls,
                                    &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,
index 5be0a85d1ebefe082228b1c5aec4296bb90dfa92..84c831c82dcd4d9370455de70fcb416eb1687a53 100644 (file)
@@ -1187,7 +1187,7 @@ static void *
 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;
@@ -1512,10 +1512,6 @@ run (void *cls,
       0},
     { NULL, 0, 0}
   };
-  static const uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
-    0
-  };
 
   cfg = c;
   /*
@@ -1538,10 +1534,8 @@ run (void *cls,
   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,
@@ -1549,6 +1543,9 @@ run (void *cls,
     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);
 }
index a5baf8cfdbcf91743de0f9743e49acc159a01b87..16f330a4dfd1bcfc0c85de8e8100cf519f799be1 100644 (file)
@@ -1358,7 +1358,7 @@ handle_client_evaluate (void *cls,
   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,
@@ -1796,7 +1796,7 @@ static void *
 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 = {
@@ -1805,7 +1805,7 @@ channel_new_cb (void *cls,
   };
   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);
@@ -1988,7 +1988,6 @@ run (void *cls,
     { &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);
@@ -1998,10 +1997,11 @@ run (void *cls,
                               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,
index ae7cb57cc360e98df49dd113cf7579eae99e4c43..812016205fa043f06d0d6aca9e77d12e3700b9ed 100644 (file)
@@ -758,7 +758,7 @@ handle_regex_result (void *cls,
   ts->channel = GNUNET_CADET_channel_create (cadet_handle,
                                              ts,
                                              id,
-                                             apptype,
+                                             GC_u2h (apptype),
                                              GNUNET_CADET_OPTION_DEFAULT);
 }
 
@@ -801,7 +801,7 @@ create_channel_to_destination (struct DestinationChannel *dt,
     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)
     {
@@ -3090,10 +3090,9 @@ run (void *cls,
 
   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);