diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-13 08:28:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-13 08:28:15 +0000 |
commit | 0a5333c2df162d6f6f9bd35ea04d57e6abcc0b6f (patch) | |
tree | a3161dc789f3d906cc02bb18c94f9cb1a6be5486 | |
parent | f9d82cbcd81da81a3e78bada99f54ccc7c9ac50b (diff) | |
download | gnunet-0a5333c2df162d6f6f9bd35ea04d57e6abcc0b6f.tar.gz gnunet-0a5333c2df162d6f6f9bd35ea04d57e6abcc0b6f.zip |
ATS API cleanup: remove 2nd callback type with virtually identical signature
-rw-r--r-- | src/ats/ats_api.c | 17 | ||||
-rw-r--r-- | src/ats/ats_api.h | 2 | ||||
-rw-r--r-- | 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) | |||
152 | if (NULL != sbc->atc->alloc_cb) | 152 | if (NULL != sbc->atc->alloc_cb) |
153 | sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, | 153 | sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, |
154 | (const struct GNUNET_PeerIdentity *) key, | 154 | (const struct GNUNET_PeerIdentity *) key, |
155 | ar->plugin_name, ar->session, ar->plugin_addr, | 155 | ar->plugin_name, ar->plugin_addr, |
156 | ar->plugin_addr_len, ar->bandwidth_out, | 156 | ar->plugin_addr_len, |
157 | ar->bandwidth_in); | 157 | ar->session, |
158 | ar->bandwidth_out, | ||
159 | ar->bandwidth_in, | ||
160 | NULL, 0); | ||
158 | } | 161 | } |
159 | else if (ntohl (ar->bandwidth_out.value__) > 0) | 162 | else if (ntohl (ar->bandwidth_out.value__) > 0) |
160 | { | 163 | { |
@@ -163,9 +166,9 @@ set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value) | |||
163 | if (NULL != sbc->atc->alloc_cb) | 166 | if (NULL != sbc->atc->alloc_cb) |
164 | sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, | 167 | sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls, |
165 | (const struct GNUNET_PeerIdentity *) key, | 168 | (const struct GNUNET_PeerIdentity *) key, |
166 | ar->plugin_name, ar->session, ar->plugin_addr, | 169 | ar->plugin_name, ar->plugin_addr, |
167 | ar->plugin_addr_len, ar->bandwidth_out, | 170 | ar->plugin_addr_len, ar->session, ar->bandwidth_out, |
168 | ar->bandwidth_in); | 171 | ar->bandwidth_in, NULL, 0); |
169 | } | 172 | } |
170 | else | 173 | else |
171 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 174 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -331,7 +334,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc) | |||
331 | */ | 334 | */ |
332 | struct GNUNET_ATS_Handle * | 335 | struct GNUNET_ATS_Handle * |
333 | GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | 336 | GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
334 | GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, | 337 | GNUNET_ATS_AddressSuggestionCallback alloc_cb, |
335 | void *alloc_cb_cls) | 338 | void *alloc_cb_cls) |
336 | { | 339 | { |
337 | struct GNUNET_ATS_Handle *atc; | 340 | 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 | |||
101 | /** | 101 | /** |
102 | * Function to call when the allocation changes. | 102 | * Function to call when the allocation changes. |
103 | */ | 103 | */ |
104 | GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb; | 104 | GNUNET_ATS_AddressSuggestionCallback alloc_cb; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Closure for 'alloc_cb'. | 107 | * 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 | |||
@@ -44,65 +44,6 @@ struct GNUNET_ATS_Handle; | |||
44 | 44 | ||
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Signature of a function called by ATS to notify the callee that the | ||
48 | * assigned bandwidth or address for a given peer was changed. If the | ||
49 | * callback is called with address/bandwidth assignments of zero, the | ||
50 | * ATS disconnect function will still be called once the disconnect | ||
51 | * actually happened. | ||
52 | * | ||
53 | * @param cls closure | ||
54 | * @param peer identity of the peer | ||
55 | * @param plugin_name name of the transport plugin, NULL to disconnect | ||
56 | * @param session session to use (if available) | ||
57 | * @param plugin_addr address to use (if available) | ||
58 | * @param plugin_addr_len number of bytes in addr | ||
59 | * @param bandwidth_out assigned outbound bandwidth for the connection | ||
60 | * @param bandwidth_in assigned inbound bandwidth for the connection | ||
61 | */ | ||
62 | typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification) (void *cls, | ||
63 | const struct | ||
64 | GNUNET_PeerIdentity | ||
65 | * peer, | ||
66 | const char | ||
67 | *plugin_name, | ||
68 | struct Session * | ||
69 | session, | ||
70 | const void | ||
71 | *plugin_addr, | ||
72 | size_t | ||
73 | plugin_addr_len, | ||
74 | struct | ||
75 | GNUNET_BANDWIDTH_Value32NBO | ||
76 | bandwidth_out, | ||
77 | struct | ||
78 | GNUNET_BANDWIDTH_Value32NBO | ||
79 | bandwidth_in); | ||
80 | |||
81 | |||
82 | /** | ||
83 | * Initialize the ATS subsystem. | ||
84 | * | ||
85 | * @param cfg configuration to use | ||
86 | * @param alloc_cb notification to call whenever the allocation changed | ||
87 | * @param alloc_cb_cls closure for 'alloc_cb' | ||
88 | * @return ats context | ||
89 | */ | ||
90 | struct GNUNET_ATS_Handle * | ||
91 | GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
92 | GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, | ||
93 | void *alloc_cb_cls); | ||
94 | |||
95 | |||
96 | /** | ||
97 | * Shutdown the ATS subsystem. | ||
98 | * | ||
99 | * @param atc handle | ||
100 | */ | ||
101 | void | ||
102 | GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Signature of a function that takes an address suggestion | 47 | * Signature of a function that takes an address suggestion |
107 | * | 48 | * |
108 | * @param cls closure | 49 | * @param cls closure |
@@ -136,6 +77,29 @@ typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | |||
136 | 77 | ||
137 | 78 | ||
138 | /** | 79 | /** |
80 | * Initialize the ATS subsystem. | ||
81 | * | ||
82 | * @param cfg configuration to use | ||
83 | * @param alloc_cb notification to call whenever the allocation changed | ||
84 | * @param alloc_cb_cls closure for 'alloc_cb' | ||
85 | * @return ats context | ||
86 | */ | ||
87 | struct GNUNET_ATS_Handle * | ||
88 | GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
89 | GNUNET_ATS_AddressSuggestionCallback alloc_cb, | ||
90 | void *alloc_cb_cls); | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Shutdown the ATS subsystem. | ||
95 | * | ||
96 | * @param atc handle | ||
97 | */ | ||
98 | void | ||
99 | GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc); | ||
100 | |||
101 | |||
102 | /** | ||
139 | * Handle to cancel suggestion request. | 103 | * Handle to cancel suggestion request. |
140 | */ | 104 | */ |
141 | struct GNUNET_ATS_SuggestionContext; | 105 | struct GNUNET_ATS_SuggestionContext; |