consolidate reclaim attribute lib
[oweals/gnunet.git] / src / include / gnunet_transport_service.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009-2016 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      Affero General Public License for more details.
14
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/>.
17
18      SPDX-License-Identifier: AGPL3.0-or-later
19  */
20
21 /**
22  * @author Christian Grothoff
23  *
24  * @file
25  * Low-level P2P IO
26  *
27  * @defgroup transport  Transport service
28  * Low-level P2P IO
29  *
30  * @see [Documentation](https://gnunet.org/transport-service)
31  *
32  * @{
33  */
34
35 #ifndef GNUNET_TRANSPORT_SERVICE_H
36 #define GNUNET_TRANSPORT_SERVICE_H
37
38 #ifdef __cplusplus
39 extern "C" {
40 #if 0 /* keep Emacsens' auto-indent happy */
41 }
42 #endif
43 #endif
44
45 #include "gnunet_util_lib.h"
46 #include "gnunet_ats_service.h"
47
48 /**
49  * Version number of the transport API.
50  */
51 #define GNUNET_TRANSPORT_VERSION 0x00000003
52
53
54 /* *************************** HELLO *************************** */
55
56 /**
57  * Handle for a #GNUNET_TRANSPORT_offer_hello operation
58  */
59 struct GNUNET_TRANSPORT_OfferHelloHandle;
60
61
62 /**
63  * Offer the transport service the HELLO of another peer.  Note that
64  * the transport service may just ignore this message if the HELLO is
65  * malformed or useless due to our local configuration.
66  *
67  * @param cfg configuration
68  * @param hello the hello message
69  * @param cont continuation to call when HELLO has been sent,
70  *      tc reason #GNUNET_SCHEDULER_REASON_TIMEOUT for fail
71  *      tc reasong #GNUNET_SCHEDULER_REASON_READ_READY for success
72  * @param cont_cls closure for @a cont
73  * @return a `struct GNUNET_TRANSPORT_OfferHelloHandle` handle or NULL on
74  * failure, in case of failure @a cont will not be called
75  *
76  */
77 struct GNUNET_TRANSPORT_OfferHelloHandle *
78 GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
79                               const struct GNUNET_MessageHeader *hello,
80                               GNUNET_SCHEDULER_TaskCallback cont,
81                               void *cont_cls);
82
83
84 /**
85  * Cancel the request to transport to offer the HELLO message
86  *
87  * @param ohh the `struct GNUNET_TRANSPORT_OfferHelloHandle` to cancel
88  */
89 void
90 GNUNET_TRANSPORT_offer_hello_cancel (
91   struct GNUNET_TRANSPORT_OfferHelloHandle *ohh);
92
93
94 /* *********************** Address to String ******************* */
95
96 /**
97  * Handle to cancel a pending address lookup.
98  */
99 struct GNUNET_TRANSPORT_AddressToStringContext;
100
101
102 /**
103  * Function to call with a textual representation of an address.  This
104  * function will be called several times with different possible
105  * textual representations, and a last time with @a address being NULL
106  * to signal the end of the iteration.  Note that @a address NULL
107  * always is the last call, regardless of the value in @a res.
108  *
109  * @param cls closure
110  * @param address NULL on end of iteration,
111  *        otherwise 0-terminated printable UTF-8 string,
112  *        in particular an empty string if @a res is #GNUNET_NO
113  * @param res result of the address to string conversion:
114  *        if #GNUNET_OK: conversion successful
115  *        if #GNUNET_NO: address was invalid (or not supported)
116  *        if #GNUNET_SYSERR: communication error (IPC error)
117  */
118 typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
119                                                           const char *address,
120                                                           int res);
121
122
123 /**
124  * Convert a binary address into a human readable address.
125  *
126  * @param cfg configuration to use
127  * @param address address to convert (binary format)
128  * @param numeric should (IP) addresses be displayed in numeric form
129  *                (otherwise do reverse DNS lookup)
130  * @param timeout how long is the lookup allowed to take at most
131  * @param aluc function to call with the results
132  * @param aluc_cls closure for @a aluc
133  * @return handle to cancel the operation, NULL on error
134  */
135 struct GNUNET_TRANSPORT_AddressToStringContext *
136 GNUNET_TRANSPORT_address_to_string (
137   const struct GNUNET_CONFIGURATION_Handle *cfg,
138   const struct GNUNET_HELLO_Address *address,
139   int numeric,
140   struct GNUNET_TIME_Relative timeout,
141   GNUNET_TRANSPORT_AddressToStringCallback aluc,
142   void *aluc_cls);
143
144
145 /**
146  * Cancel request for address conversion.
147  *
148  * @param alc the context handle
149  */
150 void
151 GNUNET_TRANSPORT_address_to_string_cancel (
152   struct GNUNET_TRANSPORT_AddressToStringContext *alc);
153
154
155 /* *********************** Monitoring ************************** */
156
157
158 /**
159  * Possible state of a neighbour.  Initially, we are
160  * #GNUNET_TRANSPORT_PS_NOT_CONNECTED.
161  *
162  * Then, there are two main paths. If we receive a SYN message, we give
163  * the inbound address to ATS. After the check we ask ATS for a suggestion
164  * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). If ATS makes a suggestion, we
165  * send our SYN_ACK and go to #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK.
166  * If we receive a ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
167  * (and notify everyone about the new connection). If the operation times out,
168  * we go to #GNUNET_TRANSPORT_PS_DISCONNECT.
169  *
170  * The other case is where we transmit a SYN message first.  We
171  * start with #GNUNET_TRANSPORT_PS_INIT_ATS.  If we get an address, we send
172  * the SYN message and go to state #GNUNET_TRANSPORT_PS_CONNECT_SENT.
173  * Once we receive a SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
174  * (and notify everyone about the new connection and send
175  * back a ACK).  If the operation times out, we go to
176  * #GNUNET_TRANSPORT_PS_DISCONNECT.
177  *
178  * If the session is in trouble (i.e. transport-level disconnect or
179  * timeout), we go to #GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a
180  * new address (we don't notify anyone about the disconnect yet).  Once we have
181  * a new address, we enter #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a SYN
182  * message.  If we receive a SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
183  * and nobody noticed that we had trouble; we also send a ACK at this time just
184  * in case.  If the operation times out, we go to
185  * #GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone about the lost
186  * connection).
187  *
188  * If ATS decides to switch addresses while we have a normal
189  * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_SYN_SENT
190  * and send a SESSION_CONNECT.  If we get a ACK back, we switch the
191  * primary connection to the suggested alternative from ATS, go back
192  * to #GNUNET_TRANSPORT_PS_CONNECTED and send a ACK to the other peer just to be
193  * sure.  If the operation times out
194  * we go to #GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given
195  * alternative address is "invalid").
196  *
197  * Once a session is in #GNUNET_TRANSPORT_PS_DISCONNECT, it is cleaned up and
198  * then goes to (#GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED).  If we receive an
199  * explicit disconnect request, we can go from any state to
200  * #GNUNET_TRANSPORT_PS_DISCONNECT, possibly after generating disconnect
201  * notifications.
202  *
203  * Note that it is quite possible that while we are in any of these
204  * states, we could receive a 'SYN' request from the other peer.
205  * We then enter a 'weird' state where we pursue our own primary state
206  * machine (as described above), but with the 'send_connect_ack' flag
207  * set to 1.  If our state machine allows us to send a 'SYN_ACK'
208  * (because we have an acceptable address), we send the 'SYN_ACK'
209  * and set the 'send_connect_ack' to 2.  If we then receive a
210  * 'ACK', we go to #GNUNET_TRANSPORT_PS_CONNECTED (and reset 'send_connect_ack'
211  * to 0).
212  *
213  */
214 enum GNUNET_TRANSPORT_PeerState
215 {
216   /**
217    * Fresh peer or completely disconnected
218    */
219   GNUNET_TRANSPORT_PS_NOT_CONNECTED = 0,
220
221   /**
222    * Asked to initiate connection, trying to get address from ATS
223    */
224   GNUNET_TRANSPORT_PS_INIT_ATS,
225
226   /**
227    * Sent SYN message to other peer, waiting for SYN_ACK
228    */
229   GNUNET_TRANSPORT_PS_SYN_SENT,
230
231   /**
232    * Received a SYN, asking ATS about address suggestions.
233    */
234   GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
235
236   /**
237    * SYN request from other peer was SYN_ACK'ed, waiting for ACK.
238    */
239   GNUNET_TRANSPORT_PS_SYN_RECV_ACK,
240
241   /**
242    * Got our SYN_ACK/ACK, connection is up.
243    */
244   GNUNET_TRANSPORT_PS_CONNECTED,
245
246   /**
247    * Connection got into trouble, rest of the system still believes
248    * it to be up, but we're getting a new address from ATS.
249    */
250   GNUNET_TRANSPORT_PS_RECONNECT_ATS,
251
252   /**
253    * Sent SYN over new address (either by ATS telling us to switch
254    * addresses or from RECONNECT_ATS); if this fails, we need to tell
255    * the rest of the system about a disconnect.
256    */
257   GNUNET_TRANSPORT_PS_RECONNECT_SENT,
258
259   /**
260    * We have some primary connection, but ATS suggested we switch
261    * to some alternative; we now sent a SYN message for the
262    * alternative session to the other peer and waiting for a
263    * SYN_ACK to make this our primary connection.
264    */
265   GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT,
266
267   /**
268    * Disconnect in progress (we're sending the DISCONNECT message to the
269    * other peer; after that is finished, the state will be cleaned up).
270    */
271   GNUNET_TRANSPORT_PS_DISCONNECT,
272
273   /**
274    * We're finished with the disconnect; and are cleaning up the state
275    * now!  We put the struct into this state when we are really in the
276    * task that calls 'free' on it and are about to remove the record
277    * from the map.  We should never find a 'struct NeighbourMapEntry'
278    * in this state in the map.  Accessing a 'struct NeighbourMapEntry'
279    * in this state virtually always means using memory that has been
280    * freed (the exception being the cleanup code in #free_neighbour()).
281    */
282   GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED
283 };
284
285
286 /**
287  * Convert a transport state to a human readable string.
288  *
289  * @param state the state
290  */
291 const char *
292 GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state);
293
294
295 /**
296  * Check if a state is defined as connected
297  *
298  * @param state the state value
299  * @return #GNUNET_YES or #GNUNET_NO
300  */
301 int
302 GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state);
303
304
305 /**
306  * Handle for a #GNUNET_TRANSPORT_monitor_peers operation.
307  */
308 struct GNUNET_TRANSPORT_PeerMonitoringContext;
309
310
311 /**
312  * Function to call with information about a peer
313  *
314  * If one_shot was set to #GNUNET_YES to iterate over all peers once,
315  * a final call with NULL for peer and address will follow when done.
316  * In this case state and timeout do not contain valid values.
317  *
318  * The #GNUNET_TRANSPORT_monitor_peers_cancel() call MUST not be called from
319  * within this function!
320  *
321  *
322  * @param cls closure
323  * @param peer peer this update is about,
324  *      NULL if this is the final last callback for a iteration operation
325  * @param address address, NULL if this is the final callback for iteration op
326  * @param state current state this peer is in
327  * @param state_timeout timeout for the current state of the peer
328  */
329 typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) (
330   void *cls,
331   const struct GNUNET_PeerIdentity *peer,
332   const struct GNUNET_HELLO_Address *address,
333   enum GNUNET_TRANSPORT_PeerState state,
334   struct GNUNET_TIME_Absolute state_timeout);
335
336
337 /**
338  * Return information about a specific peer or all peers currently known to
339  * transport service once or in monitoring mode. To obtain information about
340  * a specific peer, a peer identity can be passed. To obtain information about
341  * all peers currently known to transport service, NULL can be passed as peer
342  * identity.
343  *
344  * For each peer, the callback is called with information about the address used
345  * to communicate with this peer, the state this peer is currently in and the
346  * the current timeout for this state.
347  *
348  * Upon completion, the #GNUNET_TRANSPORT_PeerIterateCallback is called one
349  * more time with `NULL`. After this, the operation must no longer be
350  * explicitly canceled.
351  *
352  * The #GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the
353  * the peer_callback!
354  *
355  * @param cfg configuration to use
356  * @param peer a specific peer identity to obtain information for,
357  *      NULL for all peers
358  * @param one_shot #GNUNET_YES to return the current state and then end (with
359  * NULL+NULL), #GNUNET_NO to monitor peers continuously
360  * @param peer_callback function to call with the results
361  * @param peer_callback_cls closure for @a peer_callback
362  */
363 struct GNUNET_TRANSPORT_PeerMonitoringContext *
364 GNUNET_TRANSPORT_monitor_peers (
365   const struct GNUNET_CONFIGURATION_Handle *cfg,
366   const struct GNUNET_PeerIdentity *peer,
367   int one_shot,
368   GNUNET_TRANSPORT_PeerIterateCallback peer_callback,
369   void *peer_callback_cls);
370
371
372 /**
373  * Cancel request to monitor peers
374  *
375  * @param pic handle for the request to cancel
376  */
377 void
378 GNUNET_TRANSPORT_monitor_peers_cancel (
379   struct GNUNET_TRANSPORT_PeerMonitoringContext *pic);
380
381
382 /* *********************** Blacklisting ************************ */
383
384 /**
385  * Handle for blacklisting peers.
386  */
387 struct GNUNET_TRANSPORT_Blacklist;
388
389
390 /**
391  * Function that decides if a connection is acceptable or not.
392  *
393  * @param cls closure
394  * @param pid peer to approve or disapproave
395  * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not
396  */
397 typedef int (*GNUNET_TRANSPORT_BlacklistCallback) (
398   void *cls,
399   const struct GNUNET_PeerIdentity *pid);
400
401
402 /**
403  * Install a blacklist callback.  The service will be queried for all
404  * existing connections as well as any fresh connections to check if
405  * they are permitted.  If the blacklisting callback is unregistered,
406  * all hosts that were denied in the past will automatically be
407  * whitelisted again.  Cancelling the blacklist handle is also the
408  * only way to re-enable connections from peers that were previously
409  * blacklisted.
410  *
411  * @param cfg configuration to use
412  * @param cb callback to invoke to check if connections are allowed
413  * @param cb_cls closure for @a cb
414  * @return NULL on error, otherwise handle for cancellation
415  */
416 struct GNUNET_TRANSPORT_Blacklist *
417 GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
418                             GNUNET_TRANSPORT_BlacklistCallback cb,
419                             void *cb_cls);
420
421
422 /**
423  * Abort the blacklist.  Note that this function is the only way for
424  * removing a peer from the blacklist.
425  *
426  * @param br handle of the request that is to be cancelled
427  */
428 void
429 GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br);
430
431
432 /**
433  * Handle for a plugin session state monitor.
434  */
435 struct GNUNET_TRANSPORT_PluginMonitor;
436
437 /**
438  * Abstract representation of a plugin's session.
439  * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
440  */
441 struct GNUNET_TRANSPORT_PluginSession;
442
443
444 /**
445  * Possible states of a session in a plugin.
446  */
447 enum GNUNET_TRANSPORT_SessionState
448 {
449   /**
450    * The session was created (first call for each session object).
451    */
452   GNUNET_TRANSPORT_SS_INIT,
453
454   /**
455    * Initial session handshake is in progress.
456    */
457   GNUNET_TRANSPORT_SS_HANDSHAKE,
458
459   /**
460    * Session is fully UP.
461    */
462   GNUNET_TRANSPORT_SS_UP,
463
464   /**
465    * This is just an update about the session,
466    * the state did not change.
467    */
468   GNUNET_TRANSPORT_SS_UPDATE,
469
470   /**
471    * Session is being torn down and about to disappear.
472    * Last call for each session object.
473    */
474   GNUNET_TRANSPORT_SS_DONE
475 };
476
477
478 /**
479  * Information about a plugin's session.
480  */
481 struct GNUNET_TRANSPORT_SessionInfo
482 {
483   /**
484    * New state of the session.
485    */
486   enum GNUNET_TRANSPORT_SessionState state;
487
488   /**
489    * #GNUNET_YES if this is an inbound connection,
490    * #GNUNET_NO if this is an outbound connection,
491    * #GNUNET_SYSERR if connections of this plugin
492    *             are so fundamentally bidirectional
493    *             that they have no 'initiator'
494    */
495   int is_inbound;
496
497   /**
498    * Number of messages pending transmission for this session.
499    */
500   uint32_t num_msg_pending;
501
502   /**
503    * Number of bytes pending transmission for this session.
504    */
505   uint32_t num_bytes_pending;
506
507   /**
508    * Until when does this plugin refuse to receive to manage
509    * staying within the inbound quota?  ZERO if receive is
510    * active.
511    */
512   struct GNUNET_TIME_Absolute receive_delay;
513
514   /**
515    * At what time will this session timeout (unless activity
516    * happens)?
517    */
518   struct GNUNET_TIME_Absolute session_timeout;
519
520   /**
521    * Address used by the session.  Can be NULL if none is available.
522    */
523   const struct GNUNET_HELLO_Address *address;
524 };
525
526
527 /**
528  * Function called by the plugin with information about the
529  * current sessions managed by the plugin (for monitoring).
530  *
531  * @param cls closure
532  * @param session session handle this information is about,
533  *        NULL to indicate that we are "in sync" (initial
534  *        iteration complete)
535  * @param session_ctx storage location where the application
536  *        can store data; will point to NULL on #GNUNET_TRANSPORT_SS_INIT,
537  *        and must be reset to NULL on #GNUNET_TRANSPORT_SS_DONE
538  * @param info information about the state of the session,
539  *        NULL if @a session is also NULL and we are
540  *        merely signalling that the initial iteration is over;
541  *        NULL with @a session being non-NULL if the monitor
542  *        was being cancelled while sessions were active
543  */
544 typedef void (*GNUNET_TRANSPORT_SessionMonitorCallback) (
545   void *cls,
546   struct GNUNET_TRANSPORT_PluginSession *session,
547   void **session_ctx,
548   const struct GNUNET_TRANSPORT_SessionInfo *info);
549
550
551 /**
552  * Install a plugin session state monitor callback.  The callback
553  * will be notified whenever the session changes.
554  *
555  * @param cfg configuration to use
556  * @param cb callback to invoke on events
557  * @param cb_cls closure for @a cb
558  * @return NULL on error, otherwise handle for cancellation
559  */
560 struct GNUNET_TRANSPORT_PluginMonitor *
561 GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg,
562                                   GNUNET_TRANSPORT_SessionMonitorCallback cb,
563                                   void *cb_cls);
564
565
566 /**
567  * Cancel monitoring the plugin session state.  The callback will be
568  * called once for each session that is up with the "info" argument
569  * being NULL (this is just to enable client-side cleanup).
570  *
571  * @param pm handle of the request that is to be cancelled
572  */
573 void
574 GNUNET_TRANSPORT_monitor_plugins_cancel (
575   struct GNUNET_TRANSPORT_PluginMonitor *pm);
576
577
578 /**
579  * Opaque handle to the service.
580  */
581 struct GNUNET_TRANSPORT_CoreHandle;
582
583
584 /**
585  * Function called to notify transport users that another
586  * peer connected to us.
587  *
588  * @param cls closure
589  * @param peer the identity of the peer that connected; this
590  *        pointer will remain valid until the disconnect, hence
591  *        applications do not necessarily have to make a copy
592  *        of the value if they only need it until disconnect
593  * @param mq message queue to use to transmit to @a peer
594  * @return closure to use in MQ handlers
595  */
596 typedef void *(*GNUNET_TRANSPORT_NotifyConnect) (
597   void *cls,
598   const struct GNUNET_PeerIdentity *peer,
599   struct GNUNET_MQ_Handle *mq);
600
601
602 /**
603  * Function called to notify transport users that another peer
604  * disconnected from us.  The message queue that was given to the
605  * connect notification will be destroyed and must not be used
606  * henceforth.
607  *
608  * @param cls closure from #GNUNET_TRANSPORT_core_connect
609  * @param peer the peer that disconnected
610  * @param handlers_cls closure of the handlers, was returned from the
611  *                    connect notification callback
612  */
613 typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) (
614   void *cls,
615   const struct GNUNET_PeerIdentity *peer,
616   void *handler_cls);
617
618
619 /**
620  * Function called if we have "excess" bandwidth to a peer.
621  * The notification will happen the first time we have excess
622  * bandwidth, and then only again after the client has performed
623  * some transmission to the peer.
624  *
625  * Excess bandwidth is defined as being allowed (by ATS) to send
626  * more data, and us reaching the limit of the capacity build-up
627  * (which, if we go past it, means we don't use available bandwidth).
628  * See also the "max carry" in `struct GNUNET_BANDWIDTH_Tracker`.
629  *
630  * @param cls the closure
631  * @param neighbour peer that we have excess bandwidth to
632  * @param handlers_cls closure of the handlers, was returned from the
633  *                    connect notification callback
634  */
635 typedef void (*GNUNET_TRANSPORT_NotifyExcessBandwidth) (
636   void *cls,
637   const struct GNUNET_PeerIdentity *neighbour,
638   void *handlers_cls);
639
640
641 /**
642  * Connect to the transport service.  Note that the connection may
643  * complete (or fail) asynchronously.
644  *
645  * @param cfg configuration to use
646  * @param self our own identity (API should check that it matches
647  *             the identity found by transport), or NULL (no check)
648  * @param handlers array of message handlers; note that the
649  *                 closures provided will be ignored and replaced
650  *                 with the respective return value from @a nc
651  * @param handlers array with handlers to call when we receive messages, or NULL
652  * @param cls closure for the @a nc, @a nd and @a neb callbacks
653  * @param nc function to call on connect events, or NULL
654  * @param nd function to call on disconnect events, or NULL
655  * @param neb function to call if we have excess bandwidth to a peer, or NULL
656  * @return NULL on error
657  */
658 struct GNUNET_TRANSPORT_CoreHandle *
659 GNUNET_TRANSPORT_core_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
660                                const struct GNUNET_PeerIdentity *self,
661                                const struct GNUNET_MQ_MessageHandler *handlers,
662                                void *cls,
663                                GNUNET_TRANSPORT_NotifyConnect nc,
664                                GNUNET_TRANSPORT_NotifyDisconnect nd,
665                                GNUNET_TRANSPORT_NotifyExcessBandwidth neb);
666
667
668 /**
669  * Disconnect from the transport service.
670  *
671  * @param handle handle returned from connect
672  */
673 void
674 GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle);
675
676
677 /**
678  * Checks if a given peer is connected to us and get the message queue.
679  *
680  * @param handle connection to transport service
681  * @param peer the peer to check
682  * @return NULL if disconnected, otherwise message queue for @a peer
683  */
684 struct GNUNET_MQ_Handle *
685 GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle,
686                               const struct GNUNET_PeerIdentity *peer);
687
688
689 #if 0 /* keep Emacsens' auto-indent happy */
690 {
691 #endif
692 #ifdef __cplusplus
693 }
694 #endif
695
696 /* ifndef GNUNET_TRANSPORT_SERVICE_H */
697 #endif
698
699 /** @} */ /* end of group */
700
701 /* end of gnunet_transport_service.h */