diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-09 13:33:40 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-09 13:33:40 +0000 |
commit | a61fe2107d79336c3da80591c24256b6dbd3d159 (patch) | |
tree | 5e28e476165f456ff7b18214ff744402297ad37c /src/include/gnunet_transport_service.h | |
parent | 755b5bb632de94de0e6b0e55212fbcce7b6c719c (diff) | |
download | gnunet-a61fe2107d79336c3da80591c24256b6dbd3d159.tar.gz gnunet-a61fe2107d79336c3da80591c24256b6dbd3d159.zip |
changes to transport api
Diffstat (limited to 'src/include/gnunet_transport_service.h')
-rw-r--r-- | src/include/gnunet_transport_service.h | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 908489c6a..188b84110 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -99,6 +99,18 @@ typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, | |||
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Function to call with result of the try connect request. | ||
103 | * | ||
104 | * | ||
105 | * @param cls closure | ||
106 | * @param result GNUNET_OK if message was transmitted to transport service | ||
107 | * GNUNET_SYSERR if message was not transmitted to transport service | ||
108 | */ | ||
109 | typedef void (*GNUNET_TRANSPORT_TryConnectCallback) (void *cls, | ||
110 | const int result); | ||
111 | |||
112 | |||
113 | /** | ||
102 | * Function to call with a textual representation of an address. | 114 | * Function to call with a textual representation of an address. |
103 | * This function will be called several times with different possible | 115 | * This function will be called several times with different possible |
104 | * textual representations, and a last time with NULL to signal the end | 116 | * textual representations, and a last time with NULL to signal the end |
@@ -159,21 +171,39 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle); | |||
159 | 171 | ||
160 | 172 | ||
161 | /** | 173 | /** |
174 | * Opaque handle for a transmission-ready request. | ||
175 | */ | ||
176 | struct GNUNET_TRANSPORT_TryConnectHandle; | ||
177 | |||
178 | |||
179 | /** | ||
162 | * Ask the transport service to establish a connection to | 180 | * Ask the transport service to establish a connection to |
163 | * the given peer. | 181 | * the given peer. |
164 | * | 182 | * |
165 | * @param handle connection to transport service | 183 | * @param handle connection to transport service |
166 | * @param target who we should try to connect to | 184 | * @param target who we should try to connect to |
167 | * @return GNUNET_OK if request can be scheduled | 185 | * @param cb callback to be called when request was transmitted to transport |
168 | * GNUNET_NO please retry later because we are reconnecting | 186 | * service |
169 | * GNUNET_SYSERR on failure | 187 | * @return a GNUNET_TRANSPORT_TryConnectHandle handle or |
188 | * NULL on failure (cb will not be called) | ||
170 | */ | 189 | */ |
171 | int | 190 | struct GNUNET_TRANSPORT_TryConnectHandle * |
172 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, | 191 | GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle, |
173 | const struct GNUNET_PeerIdentity *target); | 192 | const struct GNUNET_PeerIdentity *target, |
193 | GNUNET_TRANSPORT_TryConnectCallback cb, | ||
194 | void *cb_cls); | ||
174 | 195 | ||
175 | 196 | ||
176 | /** | 197 | /** |
198 | * Cancel the request to transport to try a connect | ||
199 | * Callback will not be called | ||
200 | * | ||
201 | * @param tch GNUNET_TRANSPORT_TryConnectHandle handle to cancel | ||
202 | */ | ||
203 | void | ||
204 | GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch); | ||
205 | |||
206 | /** | ||
177 | * Opaque handle for a transmission-ready request. | 207 | * Opaque handle for a transmission-ready request. |
178 | */ | 208 | */ |
179 | struct GNUNET_TRANSPORT_TransmitHandle; | 209 | struct GNUNET_TRANSPORT_TransmitHandle; |
@@ -255,7 +285,7 @@ GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle, | |||
255 | /** | 285 | /** |
256 | * Stop receiving updates about changes to our HELLO message. | 286 | * Stop receiving updates about changes to our HELLO message. |
257 | * | 287 | * |
258 | * @param ghh handle returned from 'GNUNET_TRANSPORT_get_hello') | 288 | * @param ghh handle to cancel |
259 | */ | 289 | */ |
260 | void | 290 | void |
261 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh); | 291 | GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh); |
@@ -270,14 +300,24 @@ GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh); | |||
270 | * @param hello the hello message | 300 | * @param hello the hello message |
271 | * @param cont continuation to call when HELLO has been sent | 301 | * @param cont continuation to call when HELLO has been sent |
272 | * @param cls closure for continuation | 302 | * @param cls closure for continuation |
303 | * @return a GNUNET_TRANSPORT_OfferHelloHandle handle or NULL on failure | ||
304 | * | ||
273 | */ | 305 | */ |
274 | void | 306 | struct GNUNET_TRANSPORT_OfferHelloHandle * |
275 | GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, | 307 | GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, |
276 | const struct GNUNET_MessageHeader *hello, | 308 | const struct GNUNET_MessageHeader *hello, |
277 | GNUNET_SCHEDULER_Task cont, void *cls); | 309 | GNUNET_SCHEDULER_Task cont, void *cls); |
278 | 310 | ||
279 | 311 | ||
280 | /** | 312 | /** |
313 | * Cancel the request to transport to offer the HELLO message | ||
314 | * | ||
315 | * @param ohh the GNUNET_TRANSPORT_OfferHelloHandle to cancel | ||
316 | */ | ||
317 | void | ||
318 | GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *ohh); | ||
319 | |||
320 | /** | ||
281 | * Handle to cancel a pending address lookup. | 321 | * Handle to cancel a pending address lookup. |
282 | */ | 322 | */ |
283 | struct GNUNET_TRANSPORT_AddressToStringContext; | 323 | struct GNUNET_TRANSPORT_AddressToStringContext; |