gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r31376 - gnunet/src/nat


From: gnunet
Subject: [GNUnet-SVN] r31376 - gnunet/src/nat
Date: Fri, 13 Dec 2013 20:32:02 +0100

Author: grothoff
Date: 2013-12-13 20:32:02 +0100 (Fri, 13 Dec 2013)
New Revision: 31376

Modified:
   gnunet/src/nat/nat.c
   gnunet/src/nat/nat_auto.c
   gnunet/src/nat/nat_test.c
Log:
-doxygen, indentation, fixing comments

Modified: gnunet/src/nat/nat.c
===================================================================
--- gnunet/src/nat/nat.c        2013-12-13 18:05:32 UTC (rev 31375)
+++ gnunet/src/nat/nat.c        2013-12-13 19:32:02 UTC (rev 31376)
@@ -64,36 +64,36 @@
  */
 enum LocalAddressSource
 {
-    /**
-     * Address was obtained by DNS resolution of the external hostname
-     * given in the configuration (i.e. hole-punched DynDNS setup).
-     */
+  /**
+   * Address was obtained by DNS resolution of the external hostname
+   * given in the configuration (i.e. hole-punched DynDNS setup).
+   */
   LAL_EXTERNAL_IP,
 
-    /**
-     * Address was obtained by looking up our own hostname in DNS.
-     */
+  /**
+   * Address was obtained by looking up our own hostname in DNS.
+   */
   LAL_HOSTNAME_DNS,
 
-    /**
-     * Address was obtained by scanning our hosts's network interfaces
-     * and taking their address (no DNS involved).
-     */
+  /**
+   * Address was obtained by scanning our hosts's network interfaces
+   * and taking their address (no DNS involved).
+   */
   LAL_INTERFACE_ADDRESS,
 
-    /**
-     * Addresses we were explicitly bound to.
-     */
+  /**
+   * Addresses we were explicitly bound to.
+   */
   LAL_BINDTO_ADDRESS,
 
-    /**
-     * Addresses from UPnP or PMP
-     */
+  /**
+   * Addresses from UPnP or PMP
+   */
   LAL_UPNP,
 
-    /**
-     * End of the list.
-     */
+  /**
+   * End of the list.
+   */
   LAL_END
 };
 
@@ -181,7 +181,7 @@
   GNUNET_NAT_ReversalCallback reversal_callback;
 
   /**
-   * Closure for 'callback'.
+   * Closure for callbacks (@e address_callback and @e reversal_callback)
    */
   void *callback_cls;
 
@@ -272,7 +272,7 @@
   struct sockaddr **local_addrs;
 
   /**
-   * Length of the 'local_addrs'.
+   * Length of the @e local_addrs.
    */
   socklen_t *local_addrlens;
 
@@ -407,8 +407,8 @@
  *
  * @param h handle to NAT
  * @param src where did the local address originate from?
- * @param arg the address, some 'struct sockaddr'
- * @param arg_size number of bytes in arg
+ * @param arg the address, some `struct sockaddr`
+ * @param arg_size number of bytes in @a arg
  */
 static void
 add_to_address_list_as_is (struct GNUNET_NAT_Handle *h,
@@ -422,8 +422,10 @@
   lal->addrlen = arg_size;
   lal->source = src;
   GNUNET_CONTAINER_DLL_insert (h->lal_head, h->lal_tail, lal);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address `%s' from source %d\n",
-       GNUNET_a2s (arg, arg_size), src);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Adding address `%s' from source %d\n",
+       GNUNET_a2s (arg, arg_size),
+       src);
   if (NULL != h->address_callback)
     h->address_callback (h->callback_cls, GNUNET_YES, arg, arg_size);
 }
@@ -437,12 +439,14 @@
  *
  * @param h handle to NAT
  * @param src where did the local address originate from?
- * @param arg the address, some 'struct sockaddr'
- * @param arg_size number of bytes in arg
+ * @param arg the address, some `struct sockaddr`
+ * @param arg_size number of bytes in @a arg
  */
 static void
-add_to_address_list (struct GNUNET_NAT_Handle *h, enum LocalAddressSource src,
-                     const struct sockaddr *arg, socklen_t arg_size)
+add_to_address_list (struct GNUNET_NAT_Handle *h,
+                     enum LocalAddressSource src,
+                     const struct sockaddr *arg,
+                     socklen_t arg_size)
 {
   struct sockaddr_in s4;
   const struct sockaddr_in *in4;
@@ -488,7 +492,7 @@
  *
  * @param h handle to NAT
  * @param src where did the local address originate from?
- * @param addr the address, some 'struct in_addr' or 'struct in6_addr'
+ * @param addr the address, some `struct in_addr` or `struct in6_addr`
  * @param addrlen number of bytes in addr
  */
 static void
@@ -560,23 +564,28 @@
  * Our (external) hostname was resolved and the configuration says that
  * the NAT was hole-punched.
  *
- * @param cls the 'struct Plugin'
+ * @param cls the `struct GNUNET_NAT_Handle`
  * @param addr NULL on error, otherwise result of DNS lookup
- * @param addrlen number of bytes in addr
+ * @param addrlen number of bytes in @a addr
  */
 static void
-process_external_ip (void *cls, const struct sockaddr *addr, socklen_t addrlen)
+process_external_ip (void *cls,
+                     const struct sockaddr *addr,
+                     socklen_t addrlen)
 {
   struct GNUNET_NAT_Handle *h = cls;
   struct in_addr dummy;
 
-  if (addr == NULL)
+  if (NULL == addr)
   {
     h->ext_dns = NULL;
-    if (1 == inet_pton (AF_INET, h->external_address, &dummy))
+    if (1 == inet_pton (AF_INET,
+                        h->external_address,
+                        &dummy))
       return;                   /* repated lookup pointless: was numeric! */
     h->dns_task =
-        GNUNET_SCHEDULER_add_delayed (h->dyndns_frequency, &resolve_dns, h);
+      GNUNET_SCHEDULER_add_delayed (h->dyndns_frequency,
+                                    &resolve_dns, h);
     return;
   }
   add_to_address_list (h, LAL_EXTERNAL_IP, addr, addrlen);
@@ -590,7 +599,8 @@
  * @param tc scheduler context
  */
 static void
-resolve_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+resolve_hostname (void *cls,
+                  const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 /**
@@ -600,14 +610,16 @@
  *
  * @param cls closure
  * @param addr one of the addresses of the host, NULL for the last address
- * @param addrlen length of the address
+ * @param addrlen length of the @a addr
  */
 static void
-process_hostname_ip (void *cls, const struct sockaddr *addr, socklen_t addrlen)
+process_hostname_ip (void *cls,
+                     const struct sockaddr *addr,
+                     socklen_t addrlen)
 {
   struct GNUNET_NAT_Handle *h = cls;
 
-  if (addr == NULL)
+  if (NULL == addr)
   {
     h->hostname_dns = NULL;
     h->hostname_task =
@@ -623,14 +635,14 @@
  * Add the IP of our network interface to the list of
  * our IP addresses.
  *
- * @param cls the 'struct GNUNET_NAT_Handle'
+ * @param cls the `struct GNUNET_NAT_Handle`
  * @param name name of the interface
  * @param isDefault do we think this may be our default interface
  * @param addr address of the interface
  * @param broadcast_addr the broadcast address (can be NULL for unknown or 
unassigned)
  * @param netmask the network mask (can be NULL for unknown or unassigned))
- * @param addrlen number of bytes in addr
- * @return GNUNET_OK to continue iterating
+ * @param addrlen number of bytes in @a addr and @a broadcast_addr
+ * @return #GNUNET_OK to continue iterating
  */
 static int
 process_interfaces (void *cls, const char *name, int isDefault,
@@ -745,7 +757,7 @@
  * Task that restarts the gnunet-helper-nat-server process after a crash
  * after a certain delay.
  *
- * @param cls the 'struct GNUNET_NAT_Handle'
+ * @param cls the `struct GNUNET_NAT_Handle`
  * @param tc scheduler context
  */
 static void
@@ -754,22 +766,23 @@
   struct GNUNET_NAT_Handle *h = cls;
 
   h->server_read_task = GNUNET_SCHEDULER_NO_TASK;
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
+  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
     return;
   start_gnunet_nat_server (h);
 }
 
 
 /**
- * We have been notified that gnunet-helper-nat-server has written something 
to stdout.
- * Handle the output, then reschedule this function to be called again once
- * more is available.
+ * We have been notified that gnunet-helper-nat-server has written
+ * something to stdout.  Handle the output, then reschedule this
+ * function to be called again once more is available.
  *
  * @param cls the NAT handle
  * @param tc the scheduling context
  */
 static void
-nat_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+nat_server_read (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_Handle *h = cls;
   char mybuf[40];
@@ -784,11 +797,12 @@
     return;
   memset (mybuf, 0, sizeof (mybuf));
   bytes =
-      GNUNET_DISK_file_read (h->server_stdout_handle, mybuf, sizeof (mybuf));
+    GNUNET_DISK_file_read (h->server_stdout_handle, mybuf, sizeof (mybuf));
   if (bytes < 1)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Finished reading from server stdout with code: %d\n", bytes);
+         "Finished reading from server stdout with code: %d\n",
+         bytes);
     if (0 != GNUNET_OS_process_kill (h->server_proc, GNUNET_TERM_SIG))
       GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, "nat", "kill");
     GNUNET_OS_process_wait (h->server_proc);
@@ -907,7 +921,8 @@
  * @param tc scheduler context
  */
 static void
-list_interfaces (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+list_interfaces (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_Handle *h = cls;
 
@@ -915,7 +930,8 @@
   remove_from_address_list_by_source (h, LAL_INTERFACE_ADDRESS);
   GNUNET_OS_network_interfaces_list (&process_interfaces, h);
   h->ifc_task =
-      GNUNET_SCHEDULER_add_delayed (h->ifc_scan_frequency, &list_interfaces, 
h);
+    GNUNET_SCHEDULER_add_delayed (h->ifc_scan_frequency,
+                                  &list_interfaces, h);
 }
 
 
@@ -926,7 +942,8 @@
  * @param tc scheduler context
  */
 static void
-resolve_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+resolve_hostname (void *cls,
+                  const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_Handle *h = cls;
 
@@ -946,30 +963,34 @@
  * @param tc scheduler context
  */
 static void
-resolve_dns (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+resolve_dns (void *cls,
+             const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_Handle *h = cls;
 
   h->dns_task = GNUNET_SCHEDULER_NO_TASK;
+  /* NOTE #3213, bugnote #7878 */
   remove_from_address_list_by_source (h, LAL_EXTERNAL_IP);
   h->ext_dns =
       GNUNET_RESOLVER_ip_get (h->external_address, AF_INET,
-                              GNUNET_TIME_UNIT_MINUTES, &process_external_ip,
-                              h);
+                              GNUNET_TIME_UNIT_MINUTES,
+                              &process_external_ip, h);
 }
 
 
 /**
  * Add or remove UPnP-mapped addresses.
  *
- * @param cls the GNUNET_NAT_Handle
- * @param add_remove GNUNET_YES to mean the new public IP address, GNUNET_NO 
to mean
+ * @param cls the `struct GNUNET_NAT_Handle`
+ * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO 
to mean
  *     the previous (now invalid) one
  * @param addr either the previous or the new public IP address
- * @param addrlen actual lenght of the address
+ * @param addrlen actual lenght of @a addr
  */
 static void
-upnp_add (void *cls, int add_remove, const struct sockaddr *addr,
+upnp_add (void *cls,
+          int add_remove,
+          const struct sockaddr *addr,
           socklen_t addrlen)
 {
   struct GNUNET_NAT_Handle *h = cls;
@@ -1008,7 +1029,8 @@
  * @param port port to map with UPnP
  */
 static void
-add_minis (struct GNUNET_NAT_Handle *h, uint16_t port)
+add_minis (struct GNUNET_NAT_Handle *h,
+           uint16_t port)
 {
   struct MiniList *ml;
 
@@ -1019,7 +1041,7 @@
       return;                   /* already got this port */
     ml = ml->next;
   }
-  ml = GNUNET_malloc (sizeof (struct MiniList));
+  ml = GNUNET_new (struct MiniList);
   ml->port = port;
   ml->mini = GNUNET_NAT_mini_map_start (port, h->is_tcp, &upnp_add, h);
   GNUNET_CONTAINER_DLL_insert (h->mini_head, h->mini_tail, ml);
@@ -1033,7 +1055,8 @@
  * @param tc scheduler context
  */
 static void
-add_from_bind (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+add_from_bind (void *cls,
+               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   static struct in6_addr any = IN6ADDR_ANY_INIT;
   struct GNUNET_NAT_Handle *h = cls;
@@ -1087,7 +1110,7 @@
  * is taken from the corresponding sockaddr_in[6] field.
  *
  * @param cfg configuration to use
- * @param is_tcp GNUNET_YES for TCP, GNUNET_NO for UDP
+ * @param is_tcp #GNUNET_YES for TCP, #GNUNET_NO for UDP
  * @param adv_port advertised port (port we are either bound to or that our OS
  *                 locally performs redirection from to our bound port).
  * @param num_addrs number of addresses in 'addrs'
@@ -1099,9 +1122,12 @@
  * @return NULL on error, otherwise handle that can be used to unregister
  */
 struct GNUNET_NAT_Handle *
-GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp,
-                     uint16_t adv_port, unsigned int num_addrs,
-                     const struct sockaddr **addrs, const socklen_t * addrlens,
+GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                     int is_tcp,
+                     uint16_t adv_port,
+                     unsigned int num_addrs,
+                     const struct sockaddr **addrs,
+                     const socklen_t * addrlens,
                      GNUNET_NAT_AddressCallback address_callback,
                      GNUNET_NAT_ReversalCallback reversal_callback,
                      void *callback_cls)
@@ -1114,7 +1140,7 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Registered with NAT service at port %u with %u IP bound local 
addresses\n",
        (unsigned int) adv_port, num_addrs);
-  h = GNUNET_malloc (sizeof (struct GNUNET_NAT_Handle));
+  h = GNUNET_new (struct GNUNET_NAT_Handle);
   h->server_retry_delay = GNUNET_TIME_UNIT_SECONDS;
   h->cfg = cfg;
   h->is_tcp = is_tcp;
@@ -1266,7 +1292,7 @@
       GNUNET_NAT_mini_map_stop (ml->mini);
     GNUNET_free (ml);
   }
-  if (h->ext_dns != NULL)
+  if (NULL != h->ext_dns)
   {
     GNUNET_RESOLVER_request_cancel (h->ext_dns);
     h->ext_dns = NULL;
@@ -1341,8 +1367,10 @@
  * gnunet-helper-nat-client to send dummy ICMP responses to cause
  * that peer to connect to us (connection reversal).
  *
- * @return GNUNET_SYSERR on error, GNUNET_NO if nat client is disabled,
- *         GNUNET_OK otherwise
+ * @param h handle (used for configuration)
+ * @param sa the address of the peer (IPv4-only)
+ * @return #GNUNET_SYSERR on error, #GNUNET_NO if nat client is disabled,
+ *         #GNUNET_OK otherwise
  */
 int
 GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
@@ -1361,25 +1389,32 @@
   if (h->internal_address == NULL)
   {
     LOG (GNUNET_ERROR_TYPE_WARNING, "nat",
-         _
-         ("Internal IP address not known, cannot use ICMP NAT traversal 
method\n"));
+         _("Internal IP address not known, cannot use ICMP NAT traversal 
method\n"));
     return GNUNET_SYSERR;
   }
   GNUNET_assert (sa->sin_family == AF_INET);
   if (NULL == inet_ntop (AF_INET, &sa->sin_addr, inet4, INET_ADDRSTRLEN))
   {
-    GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, "nat", "inet_ntop");
+    GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING,
+                              "nat",
+                              "inet_ntop");
     return GNUNET_SYSERR;
   }
-  GNUNET_snprintf (port_as_string, sizeof (port_as_string), "%d", h->adv_port);
+  GNUNET_snprintf (port_as_string,
+                   sizeof (port_as_string),
+                   "%d",
+                   h->adv_port);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address,
-       inet4, (unsigned int) h->adv_port);
+       _("Running gnunet-helper-nat-client %s %s %u\n"),
+       h->internal_address,
+       inet4,
+       (unsigned int) h->adv_port);
   binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client");
   proc =
       GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL,
                                binary,
-                               "gnunet-helper-nat-client", h->internal_address,
+                               "gnunet-helper-nat-client",
+                               h->internal_address,
                                inet4, port_as_string, NULL);
   GNUNET_free (binary);
   if (NULL == proc)
@@ -1397,13 +1432,14 @@
  *
  * @param h the handle returned by register
  * @param addr IP address to test (IPv4 or IPv6)
- * @param addrlen number of bytes in addr
- * @return GNUNET_YES if the address is plausible,
- *         GNUNET_NO if the address is not plausible,
- *         GNUNET_SYSERR if the address is malformed
+ * @param addrlen number of bytes in @a addr
+ * @return #GNUNET_YES if the address is plausible,
+ *         #GNUNET_NO if the address is not plausible,
+ *         #GNUNET_SYSERR if the address is malformed
  */
 int
-GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, const void *addr,
+GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h,
+                         const void *addr,
                          socklen_t addrlen)
 {
   struct LocalAddressList *pos;
@@ -1416,8 +1452,7 @@
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-  pos = h->lal_head;
-  while (NULL != pos)
+  for (pos = h->lal_head; NULL != pos; pos = pos->next)
   {
     if (pos->addrlen == sizeof (struct sockaddr_in))
     {
@@ -1437,7 +1472,6 @@
     {
       GNUNET_assert (0);
     }
-    pos = pos->next;
   }
   LOG (GNUNET_ERROR_TYPE_WARNING,
        "Asked to validate one of my addresses and validation failed!\n");

Modified: gnunet/src/nat/nat_auto.c
===================================================================
--- gnunet/src/nat/nat_auto.c   2013-12-13 18:05:32 UTC (rev 31375)
+++ gnunet/src/nat/nat_auto.c   2013-12-13 19:32:02 UTC (rev 31376)
@@ -107,7 +107,7 @@
   GNUNET_NAT_AutoResultCallback fin_cb;
 
   /**
-   * Closure for 'fin_cb'.
+   * Closure for @e fin_cb.
    */
   void *fin_cb_cls;
 
@@ -161,7 +161,8 @@
  * @param tc scheduler callback
  */
 static void
-fail_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+fail_timeout (void *cls,
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
 
@@ -183,7 +184,7 @@
  * Clean up and update GUI (with success).
  *
  * @param cls the auto handle
- * @param success currently always GNUNET_OK
+ * @param success currently always #GNUNET_OK
  */
 static void
 result_callback (void *cls, int success)
@@ -203,14 +204,16 @@
   next_phase (ah);
 }
 
+
 /**
  * Main function for the connection reversal test.
  *
- * @param cls the 'int*' for the result
+ * @param cls the `struct GNUNET_NAT_AutoHandle`
  * @param tc scheduler context
  */
 static void
-reversal_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reversal_test (void *cls,
+               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
 
@@ -249,7 +252,8 @@
  * @param addr the address, NULL on errors
  */
 static void
-set_external_ipv4 (void *cls, const struct in_addr *addr)
+set_external_ipv4 (void *cls,
+                   const struct in_addr *addr)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
   char buf[INET_ADDRSTRLEN];
@@ -301,18 +305,22 @@
  * Process list of local IP addresses.  Find and set the
  * one of the default interface.
  *
- * @param cls our NAT auto handle
+ * @param cls our `struct GNUNET_NAT_AutoHandle`
  * @param name name of the interface (can be NULL for unknown)
  * @param isDefault is this presumably the default interface
  * @param addr address of this interface (can be NULL for unknown or 
unassigned)
  * @param broadcast_addr the broadcast address (can be NULL for unknown or 
unassigned)
  * @param netmask the network mask (can be NULL for unknown or unassigned))
- * @param addrlen length of the address
- * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
+ * @param addrlen length of the @a addr and @a broadcast_addr
+ * @return GNUNET_OK to continue iteration, #GNUNET_SYSERR to abort
  */
 static int
-nipo (void *cls, const char *name, int isDefault, const struct sockaddr *addr,
-      const struct sockaddr *broadcast_addr, const struct sockaddr *netmask,
+nipo (void *cls,
+      const char *name,
+      int isDefault,
+      const struct sockaddr *addr,
+      const struct sockaddr *broadcast_addr,
+      const struct sockaddr *netmask,
       socklen_t addrlen)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
@@ -519,14 +527,13 @@
 }
 
 
-
 /**
  * Start auto-configuration routine.  The resolver service should
  * be available when this function is called.
  *
  * @param cfg initial configuration
  * @param cb function to call with autoconfiguration result
- * @param cb_cls closure for cb
+ * @param cb_cls closure for @a cb
  * @return handle to cancel operation
  */
 struct GNUNET_NAT_AutoHandle *
@@ -536,7 +543,7 @@
 {
   struct GNUNET_NAT_AutoHandle *ah;
 
-  ah = GNUNET_malloc (sizeof (struct GNUNET_NAT_AutoHandle));
+  ah = GNUNET_new (struct GNUNET_NAT_AutoHandle);
   ah->fin_cb = cb;
   ah->fin_cb_cls = cb_cls;
   ah->cfg = GNUNET_CONFIGURATION_dup (cfg);
@@ -550,7 +557,7 @@
   return ah;
 }
 
-                       
+
 /**
  * Abort autoconfiguration.
  *
@@ -580,5 +587,4 @@
 }
 
 
-
 /* end of nat_auto.c */

Modified: gnunet/src/nat/nat_test.c
===================================================================
--- gnunet/src/nat/nat_test.c   2013-12-13 18:05:32 UTC (rev 31375)
+++ gnunet/src/nat/nat_test.c   2013-12-13 19:32:02 UTC (rev 31376)
@@ -195,7 +195,7 @@
  * Activity on our incoming socket.  Read data from the
  * incoming connection.
  *
- * @param cls the 'struct NatActivity'
+ * @param cls the `struct GNUNET_NAT_Test`
  * @param tc scheduler context
  */
 static void
@@ -205,7 +205,8 @@
   uint16_t data;
 
   tst->ltask =
-      GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, tst->lsock,
+      GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                     tst->lsock,
                                      &do_udp_read, tst);
   if ((NULL != tc->write_ready) &&
       (GNUNET_NETWORK_fdset_isset (tc->read_ready, tst->lsock)) &&
@@ -228,11 +229,12 @@
  * Activity on our incoming socket.  Read data from the
  * incoming connection.
  *
- * @param cls the 'struct NatActivity'
+ * @param cls the `struct NatActivity`
  * @param tc scheduler context
  */
 static void
-do_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_read (void *cls,
+         const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct NatActivity *na = cls;
   struct GNUNET_NAT_Test *tst;
@@ -264,11 +266,12 @@
  * Activity on our listen socket. Accept the
  * incoming connection.
  *
- * @param cls the 'struct GNUNET_NAT_Test'
+ * @param cls the `struct GNUNET_NAT_Test`
  * @param tc scheduler context
  */
 static void
-do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_accept (void *cls,
+           const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_NAT_Test *tst = cls;
   struct GNUNET_NETWORK_Handle *s;
@@ -288,7 +291,7 @@
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Got an inbound connection, waiting for data\n");
-  wl = GNUNET_malloc (sizeof (struct NatActivity));
+  wl = GNUNET_new (struct NatActivity);
   wl->sock = s;
   wl->h = tst;
   wl->rtask =
@@ -305,7 +308,7 @@
  * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO 
to mean
  *     the previous (now invalid) one
  * @param addr either the previous or the new public IP address
- * @param addrlen actual lenght of the address
+ * @param addrlen actual length of the @a addr
  */
 static void
 addr_cb (void *cls,
@@ -345,7 +348,7 @@
                 _("Failed to connect to `gnunet-nat-server'\n"));
     return;
   }
-  ca = GNUNET_malloc (sizeof (struct ClientActivity));
+  ca = GNUNET_new (struct ClientActivity);
   ca->client = client;
   GNUNET_CONTAINER_DLL_insert (h->ca_head, h->ca_tail, ca);
   GNUNET_break (GNUNET_OK ==
@@ -365,13 +368,16 @@
  * @param bnd_port port to bind to, 0 for connection reversal
  * @param adv_port externally advertised port to use
  * @param report function to call with the result of the test
- * @param report_cls closure for report
+ * @param report_cls closure for @a report
  * @return handle to cancel NAT test
  */
 struct GNUNET_NAT_Test *
 GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                       int is_tcp, uint16_t bnd_port, uint16_t adv_port,
-                       GNUNET_NAT_TestCallback report, void *report_cls)
+                       int is_tcp,
+                       uint16_t bnd_port,
+                       uint16_t adv_port,
+                       GNUNET_NAT_TestCallback report,
+                       void *report_cls)
 {
   struct GNUNET_NAT_Test *ret;
   struct sockaddr_in sa;




reply via email to

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