another core API simplification due to ATS introduction
authorChristian Grothoff <christian@grothoff.org>
Mon, 10 Oct 2011 11:29:59 +0000 (11:29 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 10 Oct 2011 11:29:59 +0000 (11:29 +0000)
19 files changed:
src/core/core_api.c
src/core/test_core_api.c
src/core/test_core_api_reliability.c
src/core/test_core_api_send_to_self.c
src/core/test_core_api_start_only.c
src/core/test_core_quota_compliance.c
src/dht/gnunet-service-dht_neighbours.c
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_cp.h
src/hostlist/gnunet-daemon-hostlist.c
src/include/gnunet_ats_service.h
src/include/gnunet_core_service.h
src/include/gnunet_protocols.h
src/mesh/gnunet-service-mesh.c
src/mesh/mesh_api.c
src/nse/gnunet-service-nse.c
src/testing/testing.c
src/topology/gnunet-daemon-topology.c

index 16668e9fcaab590b7ec6dd9b154305157ef571e8..78f6063229e6c55f52f2dc4fa2f5deccc687b609 100644 (file)
@@ -177,11 +177,6 @@ struct GNUNET_CORE_Handle
    */
   GNUNET_CORE_DisconnectEventHandler disconnects;
 
-  /**
-   * Function to call whenever we're notified about a peer changing status.
-   */
-  GNUNET_CORE_PeerStatusEventHandler status_events;
-
   /**
    * Function to call whenever we receive an inbound message.
    */
@@ -785,7 +780,6 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   const struct DisconnectNotifyMessage *dnm;
   const struct NotifyTrafficMessage *ntm;
   const struct GNUNET_MessageHeader *em;
-  const struct PeerStatusNotifyMessage *psnm;
   const struct SendMessageReady *smr;
   const struct GNUNET_CORE_MessageHandler *mh;
   GNUNET_CORE_StartupCallback init;
@@ -941,52 +935,6 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     if (trigger)
       trigger_next_request (h, GNUNET_NO);
     break;
-  case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_STATUS_CHANGE:
-    if (NULL == h->status_events)
-    {
-      GNUNET_break (0);
-      return;
-    }
-    if (msize < sizeof (struct PeerStatusNotifyMessage))
-    {
-      GNUNET_break (0);
-      reconnect_later (h);
-      return;
-    }
-    psnm = (const struct PeerStatusNotifyMessage *) msg;
-    if (0 == memcmp (&h->me, &psnm->peer, sizeof (struct GNUNET_PeerIdentity)))
-    {
-      /* self-change!? */
-      GNUNET_break (0);
-      return;
-    }
-    ats_count = ntohl (psnm->ats_count);
-    if ((msize !=
-         sizeof (struct PeerStatusNotifyMessage) +
-         ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)) ||
-        (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR !=
-         ntohl ((&psnm->ats)[ats_count].type)))
-    {
-      GNUNET_break (0);
-      reconnect_later (h);
-      return;
-    }
-#if DEBUG_CORE > 1
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received notification about status change by `%s'.\n",
-                GNUNET_i2s (&psnm->peer));
-#endif
-    pr = GNUNET_CONTAINER_multihashmap_get (h->peers, &psnm->peer.hashPubKey);
-    if (pr == NULL)
-    {
-      GNUNET_break (0);
-      reconnect_later (h);
-      return;
-    }
-    h->status_events (h->cls, &psnm->peer, psnm->bandwidth_in,
-                      psnm->bandwidth_out,
-                      GNUNET_TIME_absolute_ntoh (psnm->timeout), &psnm->ats);
-    break;
   case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND:
     if (msize < sizeof (struct NotifyTrafficMessage))
     {
@@ -1223,8 +1171,6 @@ reconnect (struct GNUNET_CORE_Handle *h)
   init->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_INIT);
   init->header.size = htons (msize);
   opt = GNUNET_CORE_OPTION_SEND_CONNECT | GNUNET_CORE_OPTION_SEND_DISCONNECT;
-  if (h->status_events != NULL)
-    opt |= GNUNET_CORE_OPTION_SEND_STATUS_CHANGE;
   if (h->inbound_notify != NULL)
   {
     if (h->inbound_hdr_only)
@@ -1261,7 +1207,6 @@ reconnect (struct GNUNET_CORE_Handle *h)
  *        connected to the core service; note that timeout is only meaningful if init is not NULL
  * @param connects function to call on peer connect, can be NULL
  * @param disconnects function to call on peer disconnect / timeout, can be NULL
- * @param status_events function to call on changes to peer connection status, can be NULL
  * @param inbound_notify function to call for all inbound messages, can be NULL
  * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only read the
  *                GNUNET_MessageHeader and hence we do not need to give it the full message;
@@ -1280,7 +1225,6 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
                      GNUNET_CORE_StartupCallback init,
                      GNUNET_CORE_ConnectEventHandler connects,
                      GNUNET_CORE_DisconnectEventHandler disconnects,
-                     GNUNET_CORE_PeerStatusEventHandler status_events,
                      GNUNET_CORE_MessageCallback inbound_notify,
                      int inbound_hdr_only,
                      GNUNET_CORE_MessageCallback outbound_notify,
@@ -1296,7 +1240,6 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
   h->init = init;
   h->connects = connects;
   h->disconnects = disconnects;
-  h->status_events = status_events;
   h->inbound_notify = inbound_notify;
   h->outbound_notify = outbound_notify;
   h->inbound_hdr_only = inbound_hdr_only;
index 7695f9e86b893fe3df79cf5fb744a2493effa5b6..db3bb4ce5cce68acc87e51b953bbb7b0ee8875c1 100644 (file)
@@ -299,7 +299,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
     /* connect p2 */
     p2.ch =
         GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
-                             &disconnect_notify, NULL, &inbound_notify,
+                             &disconnect_notify, &inbound_notify,
                              GNUNET_YES, &outbound_notify, GNUNET_YES,
                              handlers);
   }
@@ -347,7 +347,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                     &terminate_task_error, NULL);
   p1.ch =
       GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
-                           &disconnect_notify, NULL, &inbound_notify,
+                           &disconnect_notify, &inbound_notify,
                            GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
 }
 
index a696c7cbdb9a8ee5dcb169ee5b8d2372d9efa8a2..895b72449297cd22d2b9f2d29c340927adbfdbfb 100644 (file)
@@ -381,7 +381,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
     OKPP;
     /* connect p2 */
     GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
-                         &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+                         &disconnect_notify, &inbound_notify, GNUNET_YES,
                          &outbound_notify, GNUNET_YES, handlers);
   }
   else
@@ -451,7 +451,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   err_task =
       GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL);
   GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
-                       &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+                       &disconnect_notify, &inbound_notify, GNUNET_YES,
                        &outbound_notify, GNUNET_YES, handlers);
 }
 
index 25651beb5443aa4ab09e6dbde1397736f26b5798..b7e2b449b1eb06c932947c3557435de03903cd80 100644 (file)
@@ -182,7 +182,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                             "test_core_api_peer1.conf"));
 
   core =
-      GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL, NULL,
+      GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL,
                            NULL, 0, NULL, 0, handlers);
 
   die_task =
index 6b1f3da1c88587e99bad47edb1db1515ac2315d9..744758191aa358b33ec71fa0dd4f317f4585f9bb 100644 (file)
@@ -127,7 +127,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
     /* connect p2 */
     p2.ch =
         GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
-                             &disconnect_notify, NULL, &inbound_notify,
+                             &disconnect_notify, &inbound_notify,
                              GNUNET_YES, &outbound_notify, GNUNET_YES,
                              handlers);
   }
@@ -190,7 +190,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                     &timeout_task, NULL);
   p1.ch =
       GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
-                           &disconnect_notify, NULL, &inbound_notify,
+                           &disconnect_notify, &inbound_notify,
                            GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
 }
 
index 5fce06b31d0f8d7118c31d0bd9587a2e1584d558..e3b7606245c6a9df7441e57eccc5d41af15c9316 100644 (file)
@@ -520,7 +520,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
     OKPP;
     /* connect p2 */
     p2.ch = GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify,
-                                &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+                                &disconnect_notify, &inbound_notify, GNUNET_YES,
                                 &outbound_notify, GNUNET_YES, handlers);
   }
   else
@@ -630,7 +630,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                                         &current_quota_p2_out));
 
   p1.ch = GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify,
-                              &disconnect_notify, NULL, &inbound_notify, GNUNET_YES,
+                              &disconnect_notify, &inbound_notify, GNUNET_YES,
                               &outbound_notify, GNUNET_YES, handlers);
 }
 
index e1421e0f69b7224ac568aa9f5c1794e005c8bdc8..f4717711fb58551ff6b34ec72bff0346e3c2789b 100644 (file)
@@ -2053,7 +2053,6 @@ GDS_NEIGHBOURS_init ()
                                  &core_init,
                                  &handle_core_connect,
                                  &handle_core_disconnect, 
-                                 NULL,  /* Do we care about "status" updates? */
                                  NULL, GNUNET_NO,
                                  NULL, GNUNET_NO,
                                  core_handlers);
index f2770df3e59ec1bf5d992aae36aaa8e48314480d..d4728760dafd3862e3cf619fbd658196a0599981 100644 (file)
@@ -508,7 +508,7 @@ main_init (struct GNUNET_SERVER_Handle *server,
                                   NULL, &peer_init_handler,
                                   &peer_connect_handler,
                                   &GSF_peer_disconnect_handler_,
-                                  &GSF_peer_status_handler_, NULL, GNUNET_NO,
+                                  NULL, GNUNET_NO,
                                   NULL, GNUNET_NO, p2p_handlers);
   if (NULL == GSF_core)
   {
index 05e5bedefa6e84d22e397010dce3c0286b1e023e..0fed7b85549d6d94d22a7695b371d28d183912eb 100644 (file)
@@ -1502,32 +1502,6 @@ GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp,
 }
 
 
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param timeout absolute time when this peer will time out
- *        unless we see some further activity from it
- * @param atsi status information
- */
-void
-GSF_peer_status_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                          struct GNUNET_TIME_Absolute timeout,
-                          const struct GNUNET_TRANSPORT_ATS_Information *atsi)
-{
-  struct GSF_ConnectedPeer *cp;
-
-  cp = GNUNET_CONTAINER_multihashmap_get (cp_map, &peer->hashPubKey);
-  GNUNET_assert (NULL != cp);
-  update_atsi (cp, atsi);
-}
-
-
 /**
  * A peer disconnected from us.  Tear down the connected peer
  * record.
index 0f22b02807289f1560fabd51ce196f1382b4ae59..4a238dce82793534b80399ce347037c03ea90f4d 100644 (file)
@@ -252,25 +252,6 @@ GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp,
                                  *initiator_peer);
 
 
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param timeout absolute time when this peer will time out
- *        unless we see some further activity from it
- * @param atsi status information
- */
-void
-GSF_peer_status_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                          struct GNUNET_TIME_Absolute timeout,
-                          const struct GNUNET_TRANSPORT_ATS_Information *atsi);
-
-
 /**
  * Handle P2P "MIGRATION_STOP" message.
  *
index 859f8498c51409e07fe17bfafc04ff06e742b1c9..30f73600295848c8fc0ea45e2fe85408a64f66d8 100644 (file)
@@ -259,7 +259,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   core =
       GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_handler,
-                           &disconnect_handler, NULL, NULL, GNUNET_NO, NULL,
+                           &disconnect_handler, NULL, GNUNET_NO, NULL,
                            GNUNET_NO,
                            learning ? learn_handlers : no_learn_handlers);
 
index eb785afddfa701dc36440fa773783726b54402a0..33539bdaf572830ebc6749d2ceab097915bbfe13 100644 (file)
@@ -282,7 +282,8 @@ struct GNUNET_ATS_InformationRequestContext;
  * @param preference increase incoming traffic share preference by this amount;
  *                in the absence of "amount" reservations, we use this
  *                preference value to assign proportional bandwidth shares
- *                to all connected peers
+ *                to all connected peers; in the future, this should be
+ *                replaced with more specific QoS expressions...
  * @param info function to call with the resulting configuration information
  * @param info_cls closure for info
  * @return NULL on error
index 366986b4b0a19b5b1fdb2e1cb26ed97b7d3ec3ef..24083f1a15996c4f661480da981773143aeb742d 100644 (file)
@@ -66,33 +66,6 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls,
                                                  * atsi);
 
 
-/**
- * Method called whenever a given peer has a status change.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param timeout absolute time when this peer will time out
- *        unless we see some further activity from it
- * @param bandwidth_in available amount of inbound bandwidth
- * @param bandwidth_out available amount of outbound bandwidth
- * @param atsi performance data for the connection
- */
-typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls,
-                                                    const struct
-                                                    GNUNET_PeerIdentity * peer,
-                                                    struct
-                                                    GNUNET_BANDWIDTH_Value32NBO
-                                                    bandwidth_in,
-                                                    struct
-                                                    GNUNET_BANDWIDTH_Value32NBO
-                                                    bandwidth_out,
-                                                    struct GNUNET_TIME_Absolute
-                                                    timeout,
-                                                    const struct
-                                                    GNUNET_TRANSPORT_ATS_Information
-                                                    * atsi);
-
-
 /**
  * Method called whenever a peer disconnects.
  *
@@ -186,7 +159,6 @@ typedef void (*GNUNET_CORE_StartupCallback) (void *cls,
  *        connected to the core service; note that timeout is only meaningful if init is not NULL
  * @param connects function to call on peer connect, can be NULL
  * @param disconnects function to call on peer disconnect / timeout, can be NULL
- * @param status_events function to call on peer status changes, can be NULL
  * @param inbound_notify function to call for all inbound messages, can be NULL
  *                note that the core is allowed to drop notifications about inbound
  *                messages if the client does not process them fast enough (for this
@@ -220,7 +192,6 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
                      GNUNET_CORE_StartupCallback init,
                      GNUNET_CORE_ConnectEventHandler connects,
                      GNUNET_CORE_DisconnectEventHandler disconnects,
-                     GNUNET_CORE_PeerStatusEventHandler status_events,
                      GNUNET_CORE_MessageCallback inbound_notify,
                      int inbound_hdr_only,
                      GNUNET_CORE_MessageCallback outbound_notify,
index 1b95d847b58be01816de28144cd6109556373762..31f6e0b4ca69598dc505128195fdd2179591119c 100644 (file)
@@ -401,12 +401,6 @@ extern "C"
  */
 #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND 71
 
-/**
- * Response from server about (possibly updated) P2P
- * connection configuration.
- */
-#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 73
-
 /**
  * Request from client to transmit message.
  */
index 8d6780493929ab65b1408118348c5136687dff19..e76d440cf87fe539b8c015453cfaa263fd3e86cd 100644 (file)
@@ -3370,7 +3370,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
                                      &core_init,        /* Call core_init once connected */
                                      &core_connect,     /* Handle connects */
                                      &core_disconnect,  /* remove peers on disconnects */
-                                     NULL,      /* Do we care about "status" updates? */
                                      NULL,      /* Don't notify about all incoming messages */
                                      GNUNET_NO, /* For header only in notification */
                                      NULL,      /* Don't notify about all outbound messages */
index 4e510e596e19d015d4b30f23de5b657263b45473..9c2af545bfb8e00fc5a536cf66ee6f62ef7c4969 100644 (file)
@@ -872,7 +872,7 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
 
   ret->core =
       GNUNET_CORE_connect (cfg, 42, ret, &core_startup, &core_connect,
-                           &core_disconnect, NULL, NULL, GNUNET_NO, NULL,
+                           &core_disconnect, NULL, GNUNET_NO, NULL,
                            GNUNET_NO, core_handlers);
   ret->transport =
     GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
index 47014fd60bc559d79b58785413f1a50ff4184e57..7000ec602da6289bf7d6ebe6a18c7c3723181d30 100644 (file)
@@ -1360,7 +1360,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
                                  &core_init,    /* Call core_init once connected */
                                  &handle_core_connect,  /* Handle connects */
                                  &handle_core_disconnect,       /* Handle disconnects */
-                                 NULL,  /* Do we care about "status" updates? */
                                  NULL,  /* Don't want notified about all incoming messages */
                                  GNUNET_NO,     /* For header only inbound notification */
                                  NULL,  /* Don't want notified about all outbound messages */
index ca7ed637640e91d1158bd11ce87cb4d29db49cfc..df2a67668417fea5d92fa408fbeb39579474f32f 100644 (file)
@@ -1994,7 +1994,7 @@ reattempt_daemons_connect (void *cls,
   ctx->d1core_ready = GNUNET_NO;
   ctx->d1core =
       GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify,
-                           &connect_notify, NULL, NULL, NULL, GNUNET_NO, NULL,
+                           &connect_notify, NULL, NULL, GNUNET_NO, NULL,
                            GNUNET_NO, no_handlers);
   if (ctx->d1core == NULL)
   {
@@ -2115,7 +2115,7 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer,
 #endif
     ctx->d1core =
         GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify,
-                             &connect_notify, NULL, NULL, NULL, GNUNET_NO, NULL,
+                             &connect_notify, NULL, NULL, GNUNET_NO, NULL,
                              GNUNET_NO, no_handlers);
   }
 
index e8704552bfcfc2dd0f1dc9a5c1e968e86c4d824a..1616ab613eef992f9fef93c4c84275e27d21fb5f 100644 (file)
@@ -1278,7 +1278,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
   handle =
       GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_notify,
-                           &disconnect_notify, NULL, NULL, GNUNET_NO, NULL,
+                           &disconnect_notify, NULL, GNUNET_NO, NULL,
                            GNUNET_NO, handlers);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task,
                                 NULL);