-simplifying core API (#2400)
[oweals/gnunet.git] / src / dv / test_transport_api_dv.c
index 942ee07c013ff8b95f25820375104064f1dd3063..b24bfbf3108fefc93d7163d90a09c18c753756b4 100644 (file)
@@ -108,6 +108,8 @@ struct GNUNET_CONTAINER_MultiHashMap *peer_daemon_hash;
 
 #define MTYPE 12345
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 struct GNUNET_TestMessage
 {
   /**
@@ -120,6 +122,7 @@ struct GNUNET_TestMessage
    */
   uint32_t uid;
 };
+GNUNET_NETWORK_STRUCT_END
 
 struct PeerContext
 {
@@ -271,8 +274,8 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #endif
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
-    fclose (dotOutFile);
+    FPRINTF (dotOutFile, "%s",  "}");
+    FCLOSE (dotOutFile);
   }
 
   ok = 0;
@@ -379,8 +382,8 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
-    fclose (dotOutFile);
+    FPRINTF (dotOutFile, "%s",  "}");
+    FCLOSE (dotOutFile);
   }
 }
 
@@ -598,7 +601,7 @@ connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer,
      * Connect to the receiving peer
      */
     pos->peer2handle =
-        GNUNET_CORE_connect (pos->peer2->cfg, 1, pos, &init_notify_peer2,
+        GNUNET_CORE_connect (pos->peer2->cfg, pos, &init_notify_peer2,
                              &connect_notify_peer2, NULL, NULL, GNUNET_YES,
                              NULL, GNUNET_YES, handlers);
   }
@@ -648,7 +651,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
    * Connect to the sending peer
    */
   pos->peer1handle =
-      GNUNET_CORE_connect (pos->peer1->cfg, 1, pos, &init_notify_peer1,
+      GNUNET_CORE_connect (pos->peer1->cfg, pos, &init_notify_peer1,
                            &connect_notify_peer1, NULL, NULL, GNUNET_NO, NULL,
                            GNUNET_NO, no_handlers);
 
@@ -893,18 +896,18 @@ all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (dotOutFile != NULL)
   {
     if (distance == 1)
-      fprintf (dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
+      FPRINTF (dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
     else if (distance == 2)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname,
                second_shortname);
     else if (distance == 3)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname,
                second_shortname);
     else if (distance == 4)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname,
                second_shortname);
     else
-      fprintf (dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
                second_shortname);
   }
   GNUNET_free (second_shortname);
@@ -941,7 +944,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
 
   new_peer = GNUNET_malloc (sizeof (struct PeerContext));
   new_peer->peer_handle =
-      GNUNET_CORE_connect (cfg, 1, d, NULL, &all_connect_handler, NULL, NULL,
+      GNUNET_CORE_connect (cfg, d, NULL, &all_connect_handler, NULL, NULL,
                            GNUNET_NO, NULL, GNUNET_NO, no_handlers);
   new_peer->daemon = d;
   new_peer->next = all_peers;
@@ -1064,7 +1067,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dotOutFile = fopen (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "strict graph G {\n");
+    FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
   }
 
 #if VERBOSE
@@ -1124,7 +1127,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                              "connect_topology_option_modifier",
                                              &connect_topology_option_modifier_string))
   {
-    if (sscanf
+    if (SSCANF
         (connect_topology_option_modifier_string, "%lf",
          &connect_topology_option_modifier) != 1)
     {