gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13066 - in libmicrohttpd: . contrib src/daemon src/include


From: gnunet
Subject: [GNUnet-SVN] r13066 - in libmicrohttpd: . contrib src/daemon src/include
Date: Thu, 23 Sep 2010 07:16:15 +0200

Author: grothoff
Date: 2010-09-23 07:16:15 +0200 (Thu, 23 Sep 2010)
New Revision: 13066

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/README
   libmicrohttpd/contrib/coverage.sh
   libmicrohttpd/src/daemon/daemon.c
   libmicrohttpd/src/daemon/internal.c
   libmicrohttpd/src/daemon/internal.h
   libmicrohttpd/src/include/microhttpd.h
Log:
train hacking

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/ChangeLog     2010-09-23 05:16:15 UTC (rev 13066)
@@ -1,3 +1,8 @@
+Wed Sep 22 09:48:59 CEST 2010
+       Changed port argument from 'unsigned short' to 'uint16_t'.
+       Removed dead code when compiling with messages enabled.
+       Minimal unrelated code cleanup. -CG
+
 Tue Sep 21 15:12:41 CEST 2010
        Use "size_t" for buffer size instead of "int". -CG
 

Modified: libmicrohttpd/README
===================================================================
--- libmicrohttpd/README        2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/README        2010-09-23 05:16:15 UTC (rev 13066)
@@ -96,13 +96,12 @@
 
 Functions not covered by "make check":
 ======================================
-- MHD_get_connection_values
-- MHD_set_connection_value
-- parse_cookie_header
-- parse_arguments
-- MHD_del_response_header 
-- MHD_get_response_headers
-- MHD_tls_connection_close
+- file_reader (response.c); special case (sendfile)
+- mhd_panic_std (daemon.c); special case (abort)
+- MHD_poll (daemon.c)
+- parse_options (daemon.c)
+- MHD_set_panic_func (daemon.c)
+- MHD_get_version (daemon.c)
 
 
 Missing documentation:
@@ -111,4 +110,3 @@
 - manual:
   * document configuration options
   * document details on porting MHD (plibc, z/OS)
-

Modified: libmicrohttpd/contrib/coverage.sh
===================================================================
--- libmicrohttpd/contrib/coverage.sh   2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/contrib/coverage.sh   2010-09-23 05:16:15 UTC (rev 13066)
@@ -2,6 +2,7 @@
 # make sure configure was run with coverage enabled...
 lcov --directory . --zerocounters
 make check
+rm `find * -name "*_test.gc??"`  `find src/testcurl -name "*.gc??"` `find 
src/testzzuf -name "*.gc??"` `find src/examples -name "*.gc??"`
 for n in `find * -name "*.gc*" | grep libs`
 do
   cd `dirname $n`

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/src/daemon/daemon.c   2010-09-23 05:16:15 UTC (rev 13066)
@@ -110,9 +110,13 @@
  */
 void *mhd_panic_cls;
 
+
 /**
  * Trace up to and return master daemon. If the supplied daemon
  * is a master, then return the daemon itself.
+ *
+ * @param daemon handle to a daemon 
+ * @return master daemon handle
  */
 static struct MHD_Daemon*
 MHD_get_master (struct MHD_Daemon *daemon)
@@ -127,19 +131,38 @@
  */
 struct MHD_IPCount
 {
+  /**
+   * Address family. AF_INET or AF_INET6 for now.
+   */
   int family;
+
+  /**
+   * Actual address.
+   */
   union
   {
+    /**
+     * IPv4 address.
+     */ 
     struct in_addr ipv4;
 #if HAVE_IPV6
+    /**
+     * IPv6 address.
+     */ 
     struct in6_addr ipv6;
 #endif
   } addr;
+
+  /**
+   * Counter.
+   */
   unsigned int count;
 };
 
 /**
  * Lock shared structure for IP connection counts
+ *
+ * @param daemon handle to daemon where lock is
  */
 static void
 MHD_ip_count_lock(struct MHD_Daemon *daemon)
@@ -155,6 +178,8 @@
 
 /**
  * Unlock shared structure for IP connection counts
+ *
+ * @param daemon handle to daemon where lock is
  */
 static void
 MHD_ip_count_unlock(struct MHD_Daemon *daemon)
@@ -172,6 +197,10 @@
  * Tree comparison function for IP addresses (supplied to tsearch() family).
  * We compare everything in the struct up through the beginning of the
  * 'count' field.
+ * 
+ * @param a1 first address to compare
+ * @param a2 second address to compare
+ * @return -1, 0 or 1 depending on result of compare
  */
 static int
 MHD_ip_addr_compare(const void *a1, const void *a2)
@@ -180,11 +209,15 @@
 }
 
 /**
- * Parse address and initialize 'key' using the address. Returns MHD_YES
- * on success and MHD_NO otherwise (e.g., invalid address type).
+ * Parse address and initialize 'key' using the address.
+ *
+ * @param addr address to parse
+ * @param addrlen number of bytes in addr
+ * @param key where to store the parsed address
+ * @return MHD_YES on success and MHD_NO otherwise (e.g., invalid address type)
  */
 static int
-MHD_ip_addr_to_key(struct sockaddr *addr, socklen_t addrlen,
+MHD_ip_addr_to_key(const struct sockaddr *addr, socklen_t addrlen,
                    struct MHD_IPCount *key)
 {
   memset(key, 0, sizeof(*key));
@@ -216,12 +249,16 @@
 /**
  * Check if IP address is over its limit.
  *
+ * @param daemon handle to daemon where connection counts are tracked
+ * @param addr address to add (or increment counter)
+ * @param addrlen number of bytes in addr
  * @return Return MHD_YES if IP below limit, MHD_NO if IP has surpassed limit.
  *   Also returns MHD_NO if fails to allocate memory.
  */
 static int
 MHD_ip_limit_add(struct MHD_Daemon *daemon,
-                 struct sockaddr *addr, socklen_t addrlen)
+                 const struct sockaddr *addr,
+                socklen_t addrlen)
 {
   struct MHD_IPCount *key;
   void *node;
@@ -279,10 +316,15 @@
 /**
  * Decrement connection count for IP address, removing from table
  * count reaches 0
+ *
+ * @param daemon handle to daemon where connection counts are tracked
+ * @param addr address to remove (or decrement counter)
+ * @param addrlen number of bytes in addr
  */
 static void
 MHD_ip_limit_del(struct MHD_Daemon *daemon,
-                 struct sockaddr *addr, socklen_t addrlen)
+                 const struct sockaddr *addr,
+                socklen_t addrlen)
 {
   struct MHD_IPCount search_key;
   struct MHD_IPCount *found_key;
@@ -341,7 +383,7 @@
 /**
  * Callback for receiving data from the socket.
  *
- * @param conn the MHD connection structure
+ * @param connection the MHD connection structure
  * @param other where to write received data to
  * @param i maximum size of other (in bytes)
  * @return number of bytes actually received
@@ -364,7 +406,7 @@
 /**
  * Callback for writing data to the socket.
  *
- * @param conn the MHD connection structure
+ * @param connection the MHD connection structure
  * @param other data to write
  * @param i number of bytes to write
  * @return actual number of bytes written
@@ -388,6 +430,7 @@
 /**
  * Read and setup our certificate and key.
  *
+ * @param daemon handle to daemon to initialize
  * @return 0 on success
  */
 static int
@@ -417,6 +460,7 @@
 /**
  * Initialize security aspects of the HTTPS daemon
  *
+ * @param daemon handle to daemon to initialize
  * @return 0 on success
  */
 static int
@@ -491,7 +535,10 @@
 
 /**
  * Main function of the thread that handles an individual
- * connection when MHD_USE_THREAD_PER_CONNECTION.
+ * connection when MHD_USE_THREAD_PER_CONNECTION is set.
+ * 
+ * @param data the 'struct MHD_Connection' this thread will handle
+ * @return always NULL
  */
 static void *
 MHD_handle_connection (void *data)
@@ -709,6 +756,9 @@
  * Accept an incoming connection and create the MHD_Connection object for
  * it.  This function also enforces policy by way of checking with the
  * accept policy callback.
+ * 
+ * @param daemon handle with the listen socket
+ * @return MHD_YES on success
  */
 static int
 MHD_accept_connection (struct MHD_Daemon *daemon)
@@ -919,6 +969,8 @@
  * Free resources associated with all closed connections.
  * (destroy responses, free buffers, etc.).  A connection
  * is known to be closed if the socket_fd is -1.
+ *
+ * @param daemon daemon to clean up
  */
 static void
 MHD_cleanup_connections (struct MHD_Daemon *daemon)
@@ -1022,6 +1074,7 @@
 /**
  * Main select call.
  *
+ * @param daemon daemon to run select loop for
  * @param may_block YES if blocking, NO if non-blocking
  * @return MHD_NO on serious errors, MHD_YES on success
  */
@@ -1131,6 +1184,8 @@
 
 /**
  * Poll for new connection. Used only with THREAD_PER_CONNECTION
+ *
+ * @param daemon daemon to run poll loop for
  */
 static int
 MHD_poll (struct MHD_Daemon *daemon)
@@ -1190,6 +1245,9 @@
 /**
  * Thread that runs the select loop until the daemon
  * is explicitly shut down.
+ *
+ * @param cls 'struct MHD_Deamon' to run select loop in a thread for
+ * @return always NULL (on shutdown)
  */
 static void *
 MHD_select_thread (void *cls)
@@ -1219,7 +1277,7 @@
  */
 struct MHD_Daemon *
 MHD_start_daemon (unsigned int options,
-                  unsigned short port,
+                  uint16_t port,
                   MHD_AcceptPolicyCallback apc,
                   void *apc_cls,
                   MHD_AccessHandlerCallback dh, void *dh_cls, ...)
@@ -1241,6 +1299,7 @@
  * Parse a list of options given as varargs.
  * 
  * @param daemon the daemon to initialize
+ * @param servaddr where to store the server's listen address
  * @param ap the options
  * @return MHD_YES on success, MHD_NO on error
  */
@@ -1254,6 +1313,7 @@
  * Parse a list of options given as varargs.
  * 
  * @param daemon the daemon to initialize
+ * @param servaddr where to store the server's listen address
  * @param ... the options
  * @return MHD_YES on success, MHD_NO on error
  */
@@ -1276,6 +1336,7 @@
  * Parse a list of options given as varargs.
  * 
  * @param daemon the daemon to initialize
+ * @param servaddr where to store the server's listen address
  * @param ap the options
  * @return MHD_YES on success, MHD_NO on error
  */
@@ -1514,10 +1575,11 @@
  */
 struct MHD_Daemon *
 MHD_start_daemon_va (unsigned int options,
-                     unsigned short port,
+                     uint16_t port,
                      MHD_AcceptPolicyCallback apc,
                      void *apc_cls,
-                     MHD_AccessHandlerCallback dh, void *dh_cls, va_list ap)
+                     MHD_AccessHandlerCallback dh, void *dh_cls,
+                    va_list ap)
 {
   const int on = 1;
   struct MHD_Daemon *retVal;
@@ -1761,7 +1823,7 @@
          if ((options & MHD_USE_DEBUG) != 0)
            MHD_DLOG (retVal,
                      "Failed to bind to port %u: %s\n", 
-                     port, 
+                     (unsigned int) port, 
                      STRERROR (errno));
 #endif
          CLOSE (socket_fd);

Modified: libmicrohttpd/src/daemon/internal.c
===================================================================
--- libmicrohttpd/src/daemon/internal.c 2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/src/daemon/internal.c 2010-09-23 05:16:15 UTC (rev 13066)
@@ -27,10 +27,11 @@
 #include "internal.h"
 
 #if HAVE_MESSAGES
+#if DEBUG_STATES
 /**
  * State to string dictionary.
  */
-char *
+const char *
 MHD_state_to_string (enum MHD_CONNECTION_STATE state)
 {
   switch (state)
@@ -82,6 +83,7 @@
     }
 }
 #endif
+#endif
 
 #if HAVE_MESSAGES
 /**

Modified: libmicrohttpd/src/daemon/internal.h
===================================================================
--- libmicrohttpd/src/daemon/internal.h 2010-09-22 16:32:35 UTC (rev 13065)
+++ libmicrohttpd/src/daemon/internal.h 2010-09-23 05:16:15 UTC (rev 13066)
@@ -392,8 +392,11 @@
 #define DEBUG_STATES MHD_NO
 
 #if HAVE_MESSAGES
-char *MHD_state_to_string (enum MHD_CONNECTION_STATE state);
+#if DEBUG_STATES
+const char *
+MHD_state_to_string (enum MHD_CONNECTION_STATE state);
 #endif
+#endif
 
 /**
  * Function to receive plaintext data.
@@ -871,7 +874,7 @@
   /**
    * Listen port.
    */
-  unsigned short port;
+  uint16_t port;
 
 #if HTTPS_SUPPORT
   /**

Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h      2010-09-22 16:32:35 UTC (rev 
13065)
+++ libmicrohttpd/src/include/microhttpd.h      2010-09-23 05:16:15 UTC (rev 
13066)
@@ -939,7 +939,7 @@
  * @return NULL on error, handle to daemon on success
  */
 struct MHD_Daemon *MHD_start_daemon_va (unsigned int options,
-                                        unsigned short port,
+                                        uint16_t port,
                                         MHD_AcceptPolicyCallback apc,
                                         void *apc_cls,
                                         MHD_AccessHandlerCallback dh,
@@ -961,7 +961,7 @@
  * @return NULL on error, handle to daemon on success
  */
 struct MHD_Daemon *MHD_start_daemon (unsigned int flags,
-                                     unsigned short port,
+                                     uint16_t port,
                                      MHD_AcceptPolicyCallback apc,
                                      void *apc_cls,
                                      MHD_AccessHandlerCallback dh,




reply via email to

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