diff options
Diffstat (limited to 'src/include/gnunet_core_service.h')
-rw-r--r-- | src/include/gnunet_core_service.h | 185 |
1 files changed, 107 insertions, 78 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 447711867..1bf82030d 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -59,9 +59,11 @@ struct GNUNET_CORE_Handle; | |||
59 | * @param atsi performance data for the connection | 59 | * @param atsi performance data for the connection |
60 | */ | 60 | */ |
61 | typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | 61 | typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, |
62 | const struct | 62 | const struct |
63 | GNUNET_PeerIdentity *peer, | 63 | GNUNET_PeerIdentity * peer, |
64 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 64 | const struct |
65 | GNUNET_TRANSPORT_ATS_Information | ||
66 | * atsi); | ||
65 | 67 | ||
66 | 68 | ||
67 | /** | 69 | /** |
@@ -76,12 +78,19 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls, | |||
76 | * @param atsi performance data for the connection | 78 | * @param atsi performance data for the connection |
77 | */ | 79 | */ |
78 | typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, | 80 | typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, |
79 | const struct | 81 | const struct |
80 | GNUNET_PeerIdentity *peer, | 82 | GNUNET_PeerIdentity * peer, |
81 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 83 | struct |
82 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 84 | GNUNET_BANDWIDTH_Value32NBO |
83 | struct GNUNET_TIME_Absolute timeout, | 85 | bandwidth_in, |
84 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 86 | struct |
87 | GNUNET_BANDWIDTH_Value32NBO | ||
88 | bandwidth_out, | ||
89 | struct GNUNET_TIME_Absolute | ||
90 | timeout, | ||
91 | const struct | ||
92 | GNUNET_TRANSPORT_ATS_Information | ||
93 | * atsi); | ||
85 | 94 | ||
86 | 95 | ||
87 | /** | 96 | /** |
@@ -91,8 +100,8 @@ typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls, | |||
91 | * @param peer peer identity this notification is about | 100 | * @param peer peer identity this notification is about |
92 | */ | 101 | */ |
93 | typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | 102 | typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, |
94 | const struct | 103 | const struct |
95 | GNUNET_PeerIdentity *peer); | 104 | GNUNET_PeerIdentity * peer); |
96 | 105 | ||
97 | 106 | ||
98 | /** | 107 | /** |
@@ -108,10 +117,11 @@ typedef void (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | |||
108 | * GNUNET_SYSERR to close it (signal serious error) | 117 | * GNUNET_SYSERR to close it (signal serious error) |
109 | */ | 118 | */ |
110 | typedef int | 119 | typedef int |
111 | (*GNUNET_CORE_MessageCallback) (void *cls, | 120 | (*GNUNET_CORE_MessageCallback) (void *cls, |
112 | const struct GNUNET_PeerIdentity *other, | 121 | const struct GNUNET_PeerIdentity * other, |
113 | const struct GNUNET_MessageHeader *message, | 122 | const struct GNUNET_MessageHeader * message, |
114 | const struct GNUNET_TRANSPORT_ATS_Information *atsi); | 123 | const struct |
124 | GNUNET_TRANSPORT_ATS_Information * atsi); | ||
115 | 125 | ||
116 | 126 | ||
117 | /** | 127 | /** |
@@ -153,13 +163,13 @@ struct GNUNET_CORE_MessageHandler | |||
153 | * @param publicKey public key of this peer, NULL if we failed | 163 | * @param publicKey public key of this peer, NULL if we failed |
154 | */ | 164 | */ |
155 | typedef void | 165 | typedef void |
156 | (*GNUNET_CORE_StartupCallback) (void *cls, | 166 | (*GNUNET_CORE_StartupCallback) (void *cls, |
157 | struct GNUNET_CORE_Handle * server, | 167 | struct GNUNET_CORE_Handle * server, |
158 | const struct GNUNET_PeerIdentity * | 168 | const struct GNUNET_PeerIdentity * |
159 | my_identity, | 169 | my_identity, |
160 | const struct | 170 | const struct |
161 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded * | 171 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded * |
162 | publicKey); | 172 | publicKey); |
163 | 173 | ||
164 | 174 | ||
165 | /** | 175 | /** |
@@ -208,19 +218,27 @@ typedef void | |||
208 | * @return handle to the core service (only useful for disconnect until 'init' is called), | 218 | * @return handle to the core service (only useful for disconnect until 'init' is called), |
209 | * NULL on error (in this case, init is never called) | 219 | * NULL on error (in this case, init is never called) |
210 | */ | 220 | */ |
211 | struct GNUNET_CORE_Handle * | 221 | struct GNUNET_CORE_Handle *GNUNET_CORE_connect (const struct |
212 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 222 | GNUNET_CONFIGURATION_Handle |
213 | unsigned int queue_size, | 223 | *cfg, unsigned int queue_size, |
214 | void *cls, | 224 | void *cls, |
215 | GNUNET_CORE_StartupCallback init, | 225 | GNUNET_CORE_StartupCallback |
216 | GNUNET_CORE_ConnectEventHandler connects, | 226 | init, |
217 | GNUNET_CORE_DisconnectEventHandler disconnects, | 227 | GNUNET_CORE_ConnectEventHandler |
218 | GNUNET_CORE_PeerStatusEventHandler status_events, | 228 | connects, |
219 | GNUNET_CORE_MessageCallback inbound_notify, | 229 | GNUNET_CORE_DisconnectEventHandler |
220 | int inbound_hdr_only, | 230 | disconnects, |
221 | GNUNET_CORE_MessageCallback outbound_notify, | 231 | GNUNET_CORE_PeerStatusEventHandler |
222 | int outbound_hdr_only, | 232 | status_events, |
223 | const struct GNUNET_CORE_MessageHandler *handlers); | 233 | GNUNET_CORE_MessageCallback |
234 | inbound_notify, | ||
235 | int inbound_hdr_only, | ||
236 | GNUNET_CORE_MessageCallback | ||
237 | outbound_notify, | ||
238 | int outbound_hdr_only, | ||
239 | const struct | ||
240 | GNUNET_CORE_MessageHandler | ||
241 | *handlers); | ||
224 | 242 | ||
225 | 243 | ||
226 | /** | 244 | /** |
@@ -251,7 +269,7 @@ struct GNUNET_CORE_PeerRequestHandle; | |||
251 | * GNUNET_NO on timeout, | 269 | * GNUNET_NO on timeout, |
252 | * GNUNET_SYSERR if core was shut down | 270 | * GNUNET_SYSERR if core was shut down |
253 | */ | 271 | */ |
254 | typedef void (*GNUNET_CORE_ControlContinuation)(void *cls, int success); | 272 | typedef void (*GNUNET_CORE_ControlContinuation) (void *cls, int success); |
255 | 273 | ||
256 | 274 | ||
257 | /** | 275 | /** |
@@ -271,11 +289,17 @@ typedef void (*GNUNET_CORE_ControlContinuation)(void *cls, int success); | |||
271 | * @param cont_cls closure for cont | 289 | * @param cont_cls closure for cont |
272 | * @return NULL on error (cont will not be called), otherwise handle for cancellation | 290 | * @return NULL on error (cont will not be called), otherwise handle for cancellation |
273 | */ | 291 | */ |
274 | struct GNUNET_CORE_PeerRequestHandle * | 292 | struct GNUNET_CORE_PeerRequestHandle *GNUNET_CORE_peer_request_connect (struct |
275 | GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h, | 293 | GNUNET_CORE_Handle |
276 | const struct GNUNET_PeerIdentity * peer, | 294 | *h, |
277 | GNUNET_CORE_ControlContinuation cont, | 295 | const |
278 | void *cont_cls); | 296 | struct |
297 | GNUNET_PeerIdentity | ||
298 | *peer, | ||
299 | GNUNET_CORE_ControlContinuation | ||
300 | cont, | ||
301 | void | ||
302 | *cont_cls); | ||
279 | 303 | ||
280 | 304 | ||
281 | /** | 305 | /** |
@@ -285,7 +309,8 @@ GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h, | |||
285 | * @param req request handle that was returned for the original request | 309 | * @param req request handle that was returned for the original request |
286 | */ | 310 | */ |
287 | void | 311 | void |
288 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *req); | 312 | GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle |
313 | *req); | ||
289 | 314 | ||
290 | 315 | ||
291 | /** | 316 | /** |
@@ -301,13 +326,15 @@ GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle *r | |||
301 | * @param preference current traffic preference for the given peer | 326 | * @param preference current traffic preference for the given peer |
302 | */ | 327 | */ |
303 | typedef void | 328 | typedef void |
304 | (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, | 329 | (*GNUNET_CORE_PeerConfigurationInfoCallback) (void *cls, |
305 | const struct | 330 | const struct |
306 | GNUNET_PeerIdentity *peer, | 331 | GNUNET_PeerIdentity * peer, |
307 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 332 | struct |
308 | int32_t amount, | 333 | GNUNET_BANDWIDTH_Value32NBO |
309 | struct GNUNET_TIME_Relative res_delay, | 334 | bandwidth_out, int32_t amount, |
310 | uint64_t preference); | 335 | struct GNUNET_TIME_Relative |
336 | res_delay, | ||
337 | uint64_t preference); | ||
311 | 338 | ||
312 | 339 | ||
313 | 340 | ||
@@ -342,15 +369,15 @@ struct GNUNET_CORE_InformationRequestContext; | |||
342 | * @param info_cls closure for info | 369 | * @param info_cls closure for info |
343 | * @return NULL on error | 370 | * @return NULL on error |
344 | */ | 371 | */ |
345 | struct GNUNET_CORE_InformationRequestContext * | 372 | struct GNUNET_CORE_InformationRequestContext |
346 | GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | 373 | *GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, |
347 | const struct GNUNET_PeerIdentity *peer, | 374 | const struct GNUNET_PeerIdentity *peer, |
348 | struct GNUNET_TIME_Relative timeout, | 375 | struct GNUNET_TIME_Relative timeout, |
349 | struct GNUNET_BANDWIDTH_Value32NBO bw_out, | 376 | struct GNUNET_BANDWIDTH_Value32NBO |
350 | int32_t amount, | 377 | bw_out, int32_t amount, |
351 | uint64_t preference, | 378 | uint64_t preference, |
352 | GNUNET_CORE_PeerConfigurationInfoCallback info, | 379 | GNUNET_CORE_PeerConfigurationInfoCallback |
353 | void *info_cls); | 380 | info, void *info_cls); |
354 | 381 | ||
355 | 382 | ||
356 | /** | 383 | /** |
@@ -365,7 +392,9 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h, | |||
365 | * @param irc context returned by the original GNUNET_CORE_peer_get_info call | 392 | * @param irc context returned by the original GNUNET_CORE_peer_get_info call |
366 | */ | 393 | */ |
367 | void | 394 | void |
368 | GNUNET_CORE_peer_change_preference_cancel (struct GNUNET_CORE_InformationRequestContext *irc); | 395 | GNUNET_CORE_peer_change_preference_cancel (struct |
396 | GNUNET_CORE_InformationRequestContext | ||
397 | *irc); | ||
369 | 398 | ||
370 | 399 | ||
371 | /** | 400 | /** |
@@ -435,25 +464,25 @@ struct GNUNET_CORE_TransmitHandle; | |||
435 | * NULL if we can not even queue the request (insufficient | 464 | * NULL if we can not even queue the request (insufficient |
436 | * memory); if NULL is returned, "notify" will NOT be called. | 465 | * memory); if NULL is returned, "notify" will NOT be called. |
437 | */ | 466 | */ |
438 | struct GNUNET_CORE_TransmitHandle * | 467 | struct GNUNET_CORE_TransmitHandle *GNUNET_CORE_notify_transmit_ready (struct |
439 | GNUNET_CORE_notify_transmit_ready (struct | 468 | GNUNET_CORE_Handle |
440 | GNUNET_CORE_Handle | 469 | *handle, |
441 | *handle, | 470 | int cork, |
442 | int cork, | 471 | uint32_t |
443 | uint32_t priority, | 472 | priority, |
444 | struct | 473 | struct |
445 | GNUNET_TIME_Relative | 474 | GNUNET_TIME_Relative |
446 | maxdelay, | 475 | maxdelay, |
447 | const | 476 | const |
448 | struct | 477 | struct |
449 | GNUNET_PeerIdentity | 478 | GNUNET_PeerIdentity |
450 | *target, | 479 | *target, |
451 | size_t | 480 | size_t |
452 | notify_size, | 481 | notify_size, |
453 | GNUNET_CONNECTION_TransmitReadyNotify | 482 | GNUNET_CONNECTION_TransmitReadyNotify |
454 | notify, | 483 | notify, |
455 | void | 484 | void |
456 | *notify_cls); | 485 | *notify_cls); |
457 | 486 | ||
458 | 487 | ||
459 | /** | 488 | /** |