Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / dht / gnunet-dht-monitor.c
index e4e8c46a10bca807065bdb13f3ea7759c6b29e1b..b08521c7be337d1c3311c630efc3758acae2923a 100644 (file)
@@ -2,20 +2,18 @@
      This file is part of GNUnet.
      Copyright (C) 2012 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /**
  * @file dht/gnunet-dht-monitor.c
@@ -141,7 +139,8 @@ get_callback (void *cls,
               const struct GNUNET_PeerIdentity *path,
               const struct GNUNET_HashCode * key)
 {
-  FPRINTF (stdout, "GET #%u: type %d, key `%s'\n",
+  FPRINTF (stdout,
+           "GET #%u: type %d, key `%s'\n",
            result_count,
            (int) type,
            GNUNET_h2s_full(key));
@@ -176,8 +175,11 @@ get_resp_callback (void *cls,
                    size_t size)
 {
   FPRINTF (stdout,
-          "RESPONSE #%u: type %d, key `%s', data `%.*s'\n",
+           (GNUNET_BLOCK_TYPE_TEST == type)
+          ? "RESPONSE #%u (%s): type %d, key `%s', data `%.*s'\n"
+           : "RESPONSE #%u (%s): type %d, key `%s'\n",
            result_count,
+           GNUNET_STRINGS_absolute_time_to_string (exp),
            (int) type,
            GNUNET_h2s_full (key),
            (unsigned int) size,
@@ -215,8 +217,11 @@ put_callback (void *cls,
               size_t size)
 {
   FPRINTF (stdout,
-          "PUT %u: type %d, key `%s', data `%.*s'\n",
+           (GNUNET_BLOCK_TYPE_TEST == type)
+          ? "PUT %u (%s): type %d, key `%s', data `%.*s'\n"
+           : "PUT %u (%s): type %d, key `%s'\n",
            result_count,
+           GNUNET_STRINGS_absolute_time_to_string (exp),
            (int) type,
            GNUNET_h2s_full(key),
            (unsigned int) size,
@@ -234,7 +239,9 @@ put_callback (void *cls,
  * @param c configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_HashCode *key;
@@ -291,30 +298,30 @@ int
 main (int argc, char *const *argv)
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
-  
-    GNUNET_GETOPT_OPTION_STRING ('k',
+
+    GNUNET_GETOPT_option_string ('k',
                                  "key",
                                  "KEY",
                                  gettext_noop ("the query key"),
                                  &query_key),
-  
-    GNUNET_GETOPT_OPTION_SET_UINT ('t',
+
+    GNUNET_GETOPT_option_uint ('t',
                                    "type",
                                    "TYPE",
                                    gettext_noop ("the type of data to look for"),
                                    &block_type),
-  
-    GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T',
+
+    GNUNET_GETOPT_option_relative_time ('T',
                                             "timeout",
                                             "TIMEOUT",
                                             gettext_noop ("how long should the monitor command run"),
                                             &timeout_request),
-  
-    GNUNET_GETOPT_OPTION_SET_ONE ('V',
+
+    GNUNET_GETOPT_option_flag ('V',
                                   "verbose",
                                   gettext_noop ("be verbose (print progress information)"),
                                   &verbose),
-  
+
     GNUNET_GETOPT_OPTION_END
   };