gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29467 - in gnunet: doc/man src/gns src/include src/pt src/


From: gnunet
Subject: [GNUnet-SVN] r29467 - in gnunet: doc/man src/gns src/include src/pt src/vpn
Date: Sun, 22 Sep 2013 16:37:41 +0200

Author: grothoff
Date: 2013-09-22 16:37:41 +0200 (Sun, 22 Sep 2013)
New Revision: 29467

Modified:
   gnunet/doc/man/gnunet-vpn.1
   gnunet/src/gns/gnunet-service-gns_resolver.c
   gnunet/src/include/gnunet_vpn_service.h
   gnunet/src/pt/gnunet-daemon-pt.c
   gnunet/src/pt/test_gnunet_vpn.c
   gnunet/src/vpn/gnunet-service-vpn.c
   gnunet/src/vpn/gnunet-vpn.c
   gnunet/src/vpn/vpn.h
   gnunet/src/vpn/vpn_api.c
Log:
remove 'nac' option from VPN, always return IP immediately, always build mesh 
tunnel asynchronously afterwards

Modified: gnunet/doc/man/gnunet-vpn.1
===================================================================
--- gnunet/doc/man/gnunet-vpn.1 2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/doc/man/gnunet-vpn.1 2013-09-22 14:37:41 UTC (rev 29467)
@@ -21,9 +21,6 @@
 .IP "\-6, \-\-ipv6"
 Desired IP address on this end of the tunnel should be an IPv6 address.
 .B
-.IP "\-a, \-\-after\-connect"
-Display IP address only after the tunnel is fully connected.
-.B
 .IP "\-c FILENAME,  \-\-config=FILENAME"
 Use the configuration file FILENAME.
 .B

Modified: gnunet/src/gns/gnunet-service-gns_resolver.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns_resolver.c        2013-09-22 14:26:50 UTC 
(rev 29466)
+++ gnunet/src/gns/gnunet-service-gns_resolver.c        2013-09-22 14:37:41 UTC 
(rev 29467)
@@ -1152,7 +1152,6 @@
                                                              ntohs 
(vpn->proto),
                                                              &vpn->peer,
                                                              &vhash,
-                                                             GNUNET_NO,
                                                              
GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT),
                                                              
&vpn_allocation_cb,
                                                              rh);

Modified: gnunet/src/include/gnunet_vpn_service.h
===================================================================
--- gnunet/src/include/gnunet_vpn_service.h     2013-09-22 14:26:50 UTC (rev 
29466)
+++ gnunet/src/include/gnunet_vpn_service.h     2013-09-22 14:37:41 UTC (rev 
29467)
@@ -81,9 +81,6 @@
  * @param protocol protocol, IPPROTO_UDP or IPPROTO_TCP
  * @param peer target peer for the redirection
  * @param serv service descriptor to give to the peer
- * @param nac GNUNET_YES to notify via callback only after completion of
- *            the MESH-level connection,
- *            GNUNET_NO to notify as soon as the IP has been reserved
  * @param expiration_time at what time should the redirection expire?
  *        (this should not impact connections that are active at that time)
  * @param cb function to call with the IP
@@ -98,7 +95,6 @@
                             uint8_t protocol,
                             const struct GNUNET_PeerIdentity *peer,
                             const struct GNUNET_HashCode *serv,
-                            int nac,
                             struct GNUNET_TIME_Absolute expiration_time,
                             GNUNET_VPN_AllocationCallback cb,
                             void *cb_cls);
@@ -119,9 +115,6 @@
  * @param addr_af address family for 'addr', AF_INET or AF_INET6
  * @param addr destination IP address on the Internet; destination
  *             port is to be taken from the VPN packet itself
- * @param nac GNUNET_YES to notify via callback only after completion of
- *            the MESH-level connection,
- *            GNUNET_NO to notify as soon as the IP has been reserved
  * @param expiration_time at what time should the redirection expire?
  *        (this should not impact connections that are active at that time)
  * @param cb function to call with the IP
@@ -135,7 +128,6 @@
                           int result_af,
                           int addr_af,
                           const void *addr,
-                          int nac,
                           struct GNUNET_TIME_Absolute expiration_time,
                           GNUNET_VPN_AllocationCallback cb,
                           void *cb_cls);

Modified: gnunet/src/pt/gnunet-daemon-pt.c
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt.c    2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/pt/gnunet-daemon-pt.c    2013-09-22 14:37:41 UTC (rev 29467)
@@ -390,7 +390,6 @@
   rc->rr = GNUNET_VPN_redirect_to_ip (vpn_handle,
                                      af, af,
                                      rec->data.raw.data,
-                                     GNUNET_NO /* nac */,
                                      GNUNET_TIME_relative_to_absolute 
(TIMEOUT),
                                      &vpn_allocation_callback,
                                      rc);

Modified: gnunet/src/pt/test_gnunet_vpn.c
===================================================================
--- gnunet/src/pt/test_gnunet_vpn.c     2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/pt/test_gnunet_vpn.c     2013-09-22 14:37:41 UTC (rev 29467)
@@ -384,7 +384,7 @@
   default:
     GNUNET_assert (0);
   }
-  rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, GNUNET_YES,
+  rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, 
                                   GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb,
                                   NULL);
   ctrl_c_task_id =

Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2013-09-22 14:37:41 UTC (rev 29467)
@@ -204,23 +204,12 @@
   struct TunnelMessageQueueEntry *tmq_tail;  
 
   /**
-   * Client that needs to be notified about the tunnel being
-   * up as soon as a peer is connected; NULL for none.
-   */
-  struct GNUNET_SERVER_Client *client;
-
-  /**
    * Destination entry that has a pointer to this tunnel state;
    * NULL if this tunnel state is in the tunnel map.
    */
   struct DestinationEntry *destination_container;
 
   /**
-   * ID of the client request that caused us to setup this entry.
-   */ 
-  uint64_t request_id;
-
-  /**
    * Destination to which this tunnel leads.  Note that
    * this struct is NOT in the destination_map (but a
    * local copy) and that the 'heap_node' should always
@@ -636,40 +625,6 @@
 
 
 /**
- * Method called whenever a peer has connected to the tunnel.  Notifies
- * the waiting client that the tunnel is now up.
- *
- * FIXME merge with tunnel_create
- * 
- * @param cls closure
- * @param peer peer identity the tunnel was created to, NULL on timeout
- * @param atsi performance data for the connection
- */
-void
-tunnel_peer_connect_handler (void *cls,
-                            const struct GNUNET_PeerIdentity *peer,
-                            const struct
-                            GNUNET_ATS_Information * atsi)
-{
-  struct TunnelState *ts = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Peer %s connected to tunnel.\n",
-             GNUNET_i2s (peer));
-  GNUNET_STATISTICS_update (stats,
-                           gettext_noop ("# peers connected to mesh tunnels"),
-                           1, GNUNET_NO);
-  if (NULL == ts->client)
-    return; /* nothing to do */
-  send_client_reply (ts->client,
-                    ts->request_id,
-                    ts->af,
-                    &ts->destination_ip);
-  ts->client = NULL;
-}
-
-
-/**
  * Send a message from the message queue via mesh.
  *
  * @param cls the `struct TunnelState` with the message queue
@@ -796,14 +751,12 @@
  * Initialize the given destination entry's mesh tunnel.
  *
  * @param de destination entry for which we need to setup a tunnel
- * @param client client to notify on successful tunnel setup, or NULL for none
  * @param client_af address family of the address returned to the client
  * @param request_id request ID to send in client notification (unused if 
client is NULL)
  * @return tunnel state of the tunnel that was created
  */
 static struct TunnelState *
 create_tunnel_to_destination (struct DestinationEntry *de,
-                             struct GNUNET_SERVER_Client *client,
                              int client_af,
                              uint64_t request_id)
 {
@@ -815,11 +768,6 @@
   GNUNET_assert (NULL == de->ts);
   ts = GNUNET_new (struct TunnelState);
   ts->af = client_af;
-  if (NULL != client)
-  {
-    ts->request_id = request_id;
-    ts->client = client;
-  }
   ts->destination = *de;
   ts->destination.heap_node = NULL; /* copy is NOT in destination heap */
   de->ts = ts;
@@ -1093,7 +1041,7 @@
        available) or create a fresh one */
     is_new = GNUNET_YES;
     if (NULL == destination->ts)
-      ts = create_tunnel_to_destination (destination, NULL, af, 0);
+      ts = create_tunnel_to_destination (destination, af, 0);
     else
       ts = destination->ts;
     if (NULL == ts)
@@ -2579,16 +2527,17 @@
 
 
 /**
- * A client asks us to setup a redirection via some exit
- * node to a particular IP.  Setup the redirection and
- * give the client the allocated IP.
+ * A client asks us to setup a redirection via some exit node to a
+ * particular IP.  Setup the redirection and give the client the
+ * allocated IP.
  *
  * @param cls unused
  * @param client requesting client
  * @param message redirection request (a `struct RedirectToIpRequestMessage`)
  */
 static void
-service_redirect_to_ip (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client 
*client,
+service_redirect_to_ip (void *cls,
+                       struct GNUNET_SERVER_Client *client,
                        const struct GNUNET_MessageHeader *message)
 {
   size_t mlen;
@@ -2647,15 +2596,11 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;      
   }
-  if ( (result_af == AF_UNSPEC) ||
-       (GNUNET_NO == ntohl (msg->nac)) )
-  {
-    /* send reply "instantly" */
-    send_client_reply (client,
-                      msg->request_id,
-                      result_af,
-                      addr);
-  }
+  /* send reply with our IP address */
+  send_client_reply (client,
+                    msg->request_id,
+                    result_af,
+                    addr);  
   if (result_af == AF_UNSPEC)
   {
     /* failure, we're done */
@@ -2701,7 +2646,6 @@
   
   /* setup tunnel to destination */
   ts = create_tunnel_to_destination (de, 
-                                    (GNUNET_NO == ntohl (msg->nac)) ? NULL : 
client,
                                     result_af,
                                     msg->request_id);
   switch (result_af)
@@ -2754,15 +2698,10 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;      
   }
-  if ( (result_af == AF_UNSPEC) ||
-       (GNUNET_NO == ntohl (msg->nac)) )
-  {
-    /* send reply "instantly" */
-    send_client_reply (client,
-                      msg->request_id,
-                      result_af,
-                      addr);
-  }
+  send_client_reply (client,
+                    msg->request_id,
+                    result_af,
+                    addr);  
   if (result_af == AF_UNSPEC)
   {
     /* failure, we're done */
@@ -2802,7 +2741,6 @@
   while (GNUNET_CONTAINER_multihashmap_size (destination_map) > 
max_destination_mappings)
     expire_destination (de);
   ts = create_tunnel_to_destination (de,
-                                    (GNUNET_NO == ntohl (msg->nac)) ? NULL : 
client,
                                     result_af,
                                     msg->request_id);
   switch (result_af)
@@ -2948,75 +2886,6 @@
 
 
 /**
- * A client disconnected, clean up all references to it.
- *
- * @param cls the client that disconnected
- * @param key unused
- * @param value a `struct TunnelState *`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-cleanup_tunnel_client (void *cls,
-                      const struct GNUNET_HashCode *key,
-                      void *value)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-  struct TunnelState *ts = value;
-
-  if (client == ts->client)
-    ts->client = NULL;
-  return GNUNET_OK;
-}
-
-
-/**
- * A client disconnected, clean up all references to it.
- *
- * @param cls the client that disconnected
- * @param key unused
- * @param value a `struct DestinationEntry *`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-cleanup_destination_client (void *cls,
-                           const struct GNUNET_HashCode *key,
-                           void *value)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-  struct DestinationEntry *de = value;
-  struct TunnelState *ts;
-
-  if (NULL == (ts = de->ts))
-    return GNUNET_OK;
-  if (client == ts->client)
-    ts->client = NULL;
-  return GNUNET_OK;
-}
-
-  
-/**
- * A client has disconnected from us.  If we are currently building
- * a tunnel for it, cancel the operation.
- *
- * @param cls unused
- * @param client handle to the client that disconnected
- */
-static void
-client_disconnect (void *cls, 
-                  struct GNUNET_SERVER_Client *client)
-{
-  if (NULL != tunnel_map)
-    GNUNET_CONTAINER_multihashmap_iterate (tunnel_map,
-                                          &cleanup_tunnel_client,
-                                          client);
-  if (NULL != destination_map)
-    GNUNET_CONTAINER_multihashmap_iterate (destination_map,
-                                          &cleanup_destination_client,
-                                          client);
-}
-
-
-/**
  * Main function that will be run by the scheduler.
  *
  * @param cls closure
@@ -3176,7 +3045,6 @@
                                       &message_token, NULL, NULL);
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   GNUNET_SERVER_add_handlers (server, service_handlers);
-  GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
 }
 

Modified: gnunet/src/vpn/gnunet-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-vpn.c 2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/vpn/gnunet-vpn.c 2013-09-22 14:37:41 UTC (rev 29467)
@@ -80,11 +80,6 @@
 static int verbosity;
 
 /**
- * Option '-a':  Notify only once the tunnel is connected?
- */
-static int nac;
-
-/**
  * Global return value.
  */
 static int ret;
@@ -246,7 +241,6 @@
                                           protocol,
                                           &peer,
                                           &sd,
-                                          nac,
                                           etime,
                                           &allocation_cb, NULL);
   }
@@ -275,7 +269,6 @@
                                         req_af,
                                         dst_af,
                                         addr,
-                                        nac,
                                         etime,
                                         &allocation_cb, NULL);
   }
@@ -297,9 +290,6 @@
     {'6', "ipv6", NULL,
      gettext_noop ("request that result should be an IPv6 address"),
      0, &GNUNET_GETOPT_set_one, &ipv6},
-    {'a', "after-connect", NULL,
-     gettext_noop ("print IP address only after mesh tunnel has been created"),
-     0, &GNUNET_GETOPT_set_one, &ipv6},
     {'d', "duration", "TIME",
      gettext_noop ("how long should the mapping be valid for new tunnels?"),
      1, &GNUNET_GETOPT_set_relative_time, &duration},

Modified: gnunet/src/vpn/vpn.h
===================================================================
--- gnunet/src/vpn/vpn.h        2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/vpn/vpn.h        2013-09-22 14:37:41 UTC (rev 29467)
@@ -38,15 +38,14 @@
 struct RedirectToIpRequestMessage
 {
   /**
-   * Type is  GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP
+   * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * GNUNET_YES to notify only after completion of the mesh-level connection,
-   * GNUNET_NO to notify as soon as an address was allocated (in nbo).
+   * Always zero.
    */
-  int32_t nac GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
   
   /**
    * How long should the redirection be maintained at most?
@@ -82,15 +81,14 @@
 struct RedirectToServiceRequestMessage
 {
   /**
-   * Type is  GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE
+   * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * GNUNET_YES to notify only after completion of the mesh-level connection,
-   * GNUNET_NO to notify as soon as an address was allocated (in nbo).
+   * Always zero.
    */
-  int32_t nac GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
   
   /**
    * How long should the redirection be maintained at most?
@@ -134,7 +132,7 @@
 {
   
   /**
-   * Type is  GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP
+   * Type is #GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP
    */
   struct GNUNET_MessageHeader header;
 

Modified: gnunet/src/vpn/vpn_api.c
===================================================================
--- gnunet/src/vpn/vpn_api.c    2013-09-22 14:26:50 UTC (rev 29466)
+++ gnunet/src/vpn/vpn_api.c    2013-09-22 14:37:41 UTC (rev 29467)
@@ -143,12 +143,6 @@
   int addr_af;
   
   /**
-   * GNUNET_YES if we are to call the callback only after successful
-   * mesh tunnel creation.
-   */
-  int nac;
-  
-  /**
    * For service redirection, IPPROT_UDP or IPPROTO_TCP.
    */
   uint8_t protocol;
@@ -285,7 +279,7 @@
     GNUNET_assert (ret <= size);
     rs.header.size = htons ((uint16_t) ret);
     rs.header.type = htons 
(GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE);
-    rs.nac = htonl (rr->nac);
+    rs.reserved = htonl (0);
     rs.expiration_time = GNUNET_TIME_absolute_hton (rr->expiration_time);
     rs.protocol = htonl (rr->protocol);
     rs.result_af = htonl (rr->result_af);
@@ -312,7 +306,7 @@
     GNUNET_assert (ret <= size);
     rip.header.size = htons ((uint16_t) ret);
     rip.header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP);
-    rip.nac = htonl (rr->nac);
+    rip.reserved = htonl (0);
     rip.expiration_time = GNUNET_TIME_absolute_hton (rr->expiration_time);
     rip.result_af = htonl (rr->result_af);
     rip.addr_af = htonl (rr->addr_af);
@@ -448,9 +442,6 @@
  * @param protocol protocol, IPPROTO_UDP or IPPROTO_TCP
  * @param peer target peer for the redirection
  * @param serv service descriptor to give to the peer
- * @param nac GNUNET_YES to notify via callback only after completion of
- *            the MESH-level connection,
- *            GNUNET_NO to notify as soon as the IP has been reserved
  * @param expiration_time at what time should the redirection expire?
  *        (this should not impact connections that are active at that time)
  * @param cb function to call with the IP
@@ -465,14 +456,13 @@
                             uint8_t protocol,
                             const struct GNUNET_PeerIdentity *peer,
                             const struct GNUNET_HashCode *serv,
-                            int nac,
                             struct GNUNET_TIME_Absolute expiration_time,
                             GNUNET_VPN_AllocationCallback cb,
                             void *cb_cls)
 {
   struct GNUNET_VPN_RedirectionRequest *rr;
 
-  rr = GNUNET_malloc (sizeof (struct GNUNET_VPN_RedirectionRequest));
+  rr = GNUNET_new (struct GNUNET_VPN_RedirectionRequest);
   rr->vh = vh;
   rr->cb = cb;
   rr->cb_cls = cb_cls;
@@ -480,7 +470,6 @@
   rr->serv = *serv;
   rr->expiration_time = expiration_time;
   rr->result_af = result_af;
-  rr->nac = nac;
   rr->protocol = protocol;
   queue_request (rr);
   return rr;
@@ -501,9 +490,6 @@
  * @param addr_af address family for 'addr', AF_INET or AF_INET6
  * @param addr destination IP address on the Internet; destination
  *             port is to be taken from the VPN packet itself
- * @param nac GNUNET_YES to notify via callback only after completion of
- *            the MESH-level connection,
- *            GNUNET_NO to notify as soon as the IP has been reserved
  * @param expiration_time at what time should the redirection expire?
  *        (this should not impact connections that are active at that time)
  * @param cb function to call with the IP
@@ -517,7 +503,6 @@
                           int result_af,
                           int addr_af,
                           const void *addr,
-                          int nac,
                           struct GNUNET_TIME_Absolute expiration_time,
                           GNUNET_VPN_AllocationCallback cb,
                           void *cb_cls)
@@ -545,7 +530,6 @@
   rr->expiration_time = expiration_time;
   rr->result_af = result_af;
   rr->addr_af = addr_af;
-  rr->nac = nac;
   memcpy (&rr[1], addr, alen);
   queue_request (rr);
   return rr;
@@ -563,7 +547,7 @@
 {
   struct GNUNET_VPN_Handle *vh;
 
-  vh = GNUNET_malloc (sizeof (struct GNUNET_VPN_Handle));
+  vh = GNUNET_new (struct GNUNET_VPN_Handle);
   vh->cfg = cfg;
   vh->client = GNUNET_CLIENT_connect ("vpn", cfg);
   if (NULL == vh->client)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]