aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_connectionpool.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-04-28 19:32:10 +0200
committerChristian Grothoff <christian@grothoff.org>2019-04-28 19:32:20 +0200
commit3f945e6798d8d736ceb104b59ea1269a7abdfe8a (patch)
treeb93e3dc99deda0987e85cb256b3903de8bd74853 /src/testbed/gnunet-service-testbed_connectionpool.h
parent1227fc30369a55b82e77d35d8d128090e37dd437 (diff)
downloadgnunet-3f945e6798d8d736ceb104b59ea1269a7abdfe8a.tar.gz
gnunet-3f945e6798d8d736ceb104b59ea1269a7abdfe8a.zip
towards flow control in TNG
Diffstat (limited to 'src/testbed/gnunet-service-testbed_connectionpool.h')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.h56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.h b/src/testbed/gnunet-service-testbed_connectionpool.h
index ca4ea22ce..558918c30 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.h
+++ b/src/testbed/gnunet-service-testbed_connectionpool.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -25,7 +25,7 @@
25 */ 25 */
26#include "gnunet_ats_service.h" 26#include "gnunet_ats_service.h"
27#include "gnunet_core_service.h" 27#include "gnunet_core_service.h"
28#include "gnunet_transport_core_service.h" 28#include "gnunet_transport_service.h"
29 29
30/** 30/**
31 * The request handle for obtaining a pooled connection 31 * The request handle for obtaining a pooled connection
@@ -87,13 +87,13 @@ GST_connection_pool_destroy (void);
87 * cases, its value being NULL means that CORE connection has failed. 87 * cases, its value being NULL means that CORE connection has failed.
88 * @param cfg configuration of the peer 88 * @param cfg configuration of the peer
89 */ 89 */
90typedef void 90typedef void (*GST_connection_pool_connection_ready_cb) (
91(*GST_connection_pool_connection_ready_cb) (void *cls, 91 void *cls,
92 struct GNUNET_CORE_Handle *ch, 92 struct GNUNET_CORE_Handle *ch,
93 struct GNUNET_TRANSPORT_CoreHandle *th, 93 struct GNUNET_TRANSPORT_CoreHandle *th,
94 struct GNUNET_ATS_ConnectivityHandle *ac, 94 struct GNUNET_ATS_ConnectivityHandle *ac,
95 const struct GNUNET_PeerIdentity *peer_id, 95 const struct GNUNET_PeerIdentity *peer_id,
96 const struct GNUNET_CONFIGURATION_Handle *cfg); 96 const struct GNUNET_CONFIGURATION_Handle *cfg);
97 97
98 98
99/** 99/**
@@ -104,9 +104,9 @@ typedef void
104 * callback 104 * callback
105 * @param target the peer identity of the target peer 105 * @param target the peer identity of the target peer
106 */ 106 */
107typedef void 107typedef void (*GST_connection_pool_peer_connect_notify) (
108(*GST_connection_pool_peer_connect_notify) (void *cls, 108 void *cls,
109 const struct GNUNET_PeerIdentity *target); 109 const struct GNUNET_PeerIdentity *target);
110 110
111 111
112/** 112/**
@@ -121,9 +121,9 @@ typedef void
121 * @note @a connect_notify_cb will not be called if @a target is 121 * @note @a connect_notify_cb will not be called if @a target is
122 * already connected @a service level. Use 122 * already connected @a service level. Use
123 * GNUNET_TRANSPORT_check_peer_connected() or a similar function from the 123 * GNUNET_TRANSPORT_check_peer_connected() or a similar function from the
124 * respective @a service's API to check if the target peer is already connected or 124 * respective @a service's API to check if the target peer is already connected
125 * not. @a connect_notify_cb will be called only once or never (in case @a target 125 * or not. @a connect_notify_cb will be called only once or never (in case @a
126 * cannot be connected or is already connected). 126 * target cannot be connected or is already connected).
127 * 127 *
128 * @param peer_id the index of the peer 128 * @param peer_id the index of the peer
129 * @param cfg the configuration with which the transport handle has to be 129 * @param cfg the configuration with which the transport handle has to be
@@ -132,7 +132,8 @@ typedef void
132 * @param cb the callback to notify when the transport handle is available 132 * @param cb the callback to notify when the transport handle is available
133 * @param cb_cls the closure for @a cb 133 * @param cb_cls the closure for @a cb
134 * @param target the peer identify of the peer whose connection to our TRANSPORT 134 * @param target the peer identify of the peer whose connection to our TRANSPORT
135 * subsystem will be notified through the @a connect_notify_cb. Can be NULL 135 * subsystem will be notified through the @a connect_notify_cb. Can be
136 * NULL
136 * @param connect_notify_cb the callback to call when the @a target peer is 137 * @param connect_notify_cb the callback to call when the @a target peer is
137 * connected. This callback will only be called once or never again (in 138 * connected. This callback will only be called once or never again (in
138 * case the target peer cannot be connected). Can be NULL 139 * case the target peer cannot be connected). Can be NULL
@@ -141,14 +142,15 @@ typedef void
141 * longer being used 142 * longer being used
142 */ 143 */
143struct GST_ConnectionPool_GetHandle * 144struct GST_ConnectionPool_GetHandle *
144GST_connection_pool_get_handle (unsigned int peer_id, 145GST_connection_pool_get_handle (
145 const struct GNUNET_CONFIGURATION_Handle *cfg, 146 unsigned int peer_id,
146 enum GST_ConnectionPool_Service service, 147 const struct GNUNET_CONFIGURATION_Handle *cfg,
147 GST_connection_pool_connection_ready_cb cb, 148 enum GST_ConnectionPool_Service service,
148 void *cb_cls, 149 GST_connection_pool_connection_ready_cb cb,
149 const struct GNUNET_PeerIdentity *target, 150 void *cb_cls,
150 GST_connection_pool_peer_connect_notify connect_notify_cb, 151 const struct GNUNET_PeerIdentity *target,
151 void *connect_notify_cb_cls); 152 GST_connection_pool_peer_connect_notify connect_notify_cb,
153 void *connect_notify_cb_cls);
152 154
153 155
154/** 156/**
@@ -157,9 +159,9 @@ GST_connection_pool_get_handle (unsigned int peer_id,
157 * #GST_ConnectionPool_GetHandle objects, it is left in the connection pool. If 159 * #GST_ConnectionPool_GetHandle objects, it is left in the connection pool. If
158 * no other objects are using the connection and the connection pool is not full 160 * no other objects are using the connection and the connection pool is not full
159 * then it is placed in a LRU queue. If the connection pool is full, then 161 * then it is placed in a LRU queue. If the connection pool is full, then
160 * connections from the LRU queue are evicted and closed to create place for this 162 * connections from the LRU queue are evicted and closed to create place for
161 * connection. If the connection pool if full and the LRU queue is empty, then 163 * this connection. If the connection pool if full and the LRU queue is empty,
162 * the connection is closed. 164 * then the connection is closed.
163 * 165 *
164 * @param gh the handle 166 * @param gh the handle
165 */ 167 */