From 0a5333c2df162d6f6f9bd35ea04d57e6abcc0b6f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 13 Oct 2011 08:28:15 +0000 Subject: [PATCH] ATS API cleanup: remove 2nd callback type with virtually identical signature --- src/ats/ats_api.c | 17 ++++--- src/ats/ats_api.h | 2 +- src/include/gnunet_ats_service.h | 82 +++++++++----------------------- 3 files changed, 34 insertions(+), 67 deletions(-) diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c index b5467cdb3..ef2fa1bed 100644 --- a/src/ats/ats_api.c +++ b/src/ats/ats_api.c @@ -152,9 +152,12 @@ set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value) if (NULL != sbc->atc->alloc_cb) sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, (const struct GNUNET_PeerIdentity *) key, - ar->plugin_name, ar->session, ar->plugin_addr, - ar->plugin_addr_len, ar->bandwidth_out, - ar->bandwidth_in); + ar->plugin_name, ar->plugin_addr, + ar->plugin_addr_len, + ar->session, + ar->bandwidth_out, + ar->bandwidth_in, + NULL, 0); } else if (ntohl (ar->bandwidth_out.value__) > 0) { @@ -163,9 +166,9 @@ set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value) if (NULL != sbc->atc->alloc_cb) sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, (const struct GNUNET_PeerIdentity *) key, - ar->plugin_name, ar->session, ar->plugin_addr, - ar->plugin_addr_len, ar->bandwidth_out, - ar->bandwidth_in); + ar->plugin_name, ar->plugin_addr, + ar->plugin_addr_len, ar->session, ar->bandwidth_out, + ar->bandwidth_in, NULL, 0); } else LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -331,7 +334,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc) */ struct GNUNET_ATS_Handle * GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, + GNUNET_ATS_AddressSuggestionCallback alloc_cb, void *alloc_cb_cls) { struct GNUNET_ATS_Handle *atc; diff --git a/src/ats/ats_api.h b/src/ats/ats_api.h index c3ae24885..a2c248cd8 100644 --- a/src/ats/ats_api.h +++ b/src/ats/ats_api.h @@ -101,7 +101,7 @@ struct GNUNET_ATS_Handle /** * Function to call when the allocation changes. */ - GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb; + GNUNET_ATS_AddressSuggestionCallback alloc_cb; /** * Closure for 'alloc_cb'. diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 33539bdaf..713178411 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h @@ -43,65 +43,6 @@ struct GNUNET_ATS_Handle; -/** - * Signature of a function called by ATS to notify the callee that the - * assigned bandwidth or address for a given peer was changed. If the - * callback is called with address/bandwidth assignments of zero, the - * ATS disconnect function will still be called once the disconnect - * actually happened. - * - * @param cls closure - * @param peer identity of the peer - * @param plugin_name name of the transport plugin, NULL to disconnect - * @param session session to use (if available) - * @param plugin_addr address to use (if available) - * @param plugin_addr_len number of bytes in addr - * @param bandwidth_out assigned outbound bandwidth for the connection - * @param bandwidth_in assigned inbound bandwidth for the connection - */ -typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification) (void *cls, - const struct - GNUNET_PeerIdentity - * peer, - const char - *plugin_name, - struct Session * - session, - const void - *plugin_addr, - size_t - plugin_addr_len, - struct - GNUNET_BANDWIDTH_Value32NBO - bandwidth_out, - struct - GNUNET_BANDWIDTH_Value32NBO - bandwidth_in); - - -/** - * Initialize the ATS subsystem. - * - * @param cfg configuration to use - * @param alloc_cb notification to call whenever the allocation changed - * @param alloc_cb_cls closure for 'alloc_cb' - * @return ats context - */ -struct GNUNET_ATS_Handle * -GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, - void *alloc_cb_cls); - - -/** - * Shutdown the ATS subsystem. - * - * @param atc handle - */ -void -GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); - - /** * Signature of a function that takes an address suggestion * @@ -135,6 +76,29 @@ typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, uint32_t ats_count); +/** + * Initialize the ATS subsystem. + * + * @param cfg configuration to use + * @param alloc_cb notification to call whenever the allocation changed + * @param alloc_cb_cls closure for 'alloc_cb' + * @return ats context + */ +struct GNUNET_ATS_Handle * +GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_ATS_AddressSuggestionCallback alloc_cb, + void *alloc_cb_cls); + + +/** + * Shutdown the ATS subsystem. + * + * @param atc handle + */ +void +GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); + + /** * Handle to cancel suggestion request. */ -- 2.25.1