2 This file is part of GNUnet.
3 Copyright (C) 2009-2014 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
27 * @defgroup transport Transport service
30 * @see [Documentation](https://gnunet.org/transport-service)
35 #ifndef GNUNET_TRANSPORT_SERVICE_H
36 #define GNUNET_TRANSPORT_SERVICE_H
41 #if 0 /* keep Emacsens' auto-indent happy */
46 #include "gnunet_util_lib.h"
47 #include "gnunet_ats_service.h"
50 * Version number of the transport API.
52 #define GNUNET_TRANSPORT_VERSION 0x00000002
56 * Function called by the transport for each received message.
59 * @param peer (claimed) identity of the other peer
60 * @param message the message
63 (*GNUNET_TRANSPORT_ReceiveCallback) (void *cls,
64 const struct GNUNET_PeerIdentity *peer,
65 const struct GNUNET_MessageHeader *message);
69 * Function called to notify transport users that another
70 * peer connected to us.
73 * @param peer the peer that connected
76 (*GNUNET_TRANSPORT_NotifyConnect) (void *cls,
77 const struct GNUNET_PeerIdentity *peer);
81 * Function called to notify transport users that another
82 * peer disconnected from us.
85 * @param peer the peer that disconnected
88 (*GNUNET_TRANSPORT_NotifyDisconnect) (void *cls,
89 const struct GNUNET_PeerIdentity *peer);
93 * Connect to the transport service. Note that the connection may
94 * complete (or fail) asynchronously.
96 * @param cfg configuration to use
97 * @param self our own identity (API should check that it matches
98 * the identity found by transport), or NULL (no check)
99 * @param cls closure for the callbacks
100 * @param rec receive function to call, or NULL
101 * @param nc function to call on connect events, or NULL
102 * @param nd function to call on disconnect events, or NULL
103 * @return NULL on error
105 struct GNUNET_TRANSPORT_Handle *
106 GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
107 const struct GNUNET_PeerIdentity *self,
109 GNUNET_TRANSPORT_ReceiveCallback rec,
110 GNUNET_TRANSPORT_NotifyConnect nc,
111 GNUNET_TRANSPORT_NotifyDisconnect nd);
115 * Function called if we have "excess" bandwidth to a peer.
116 * The notification will happen the first time we have excess
117 * bandwidth, and then only again after the client has performed
118 * some transmission to the peer.
120 * Excess bandwidth is defined as being allowed (by ATS) to send
121 * more data, and us reaching the limit of the capacity build-up
122 * (which, if we go past it, means we don't use available bandwidth).
123 * See also the "max carry" in `struct GNUNET_BANDWIDTH_Tracker`.
125 * @param cls the closure
126 * @param neighbour peer that we have excess bandwidth to
129 (*GNUNET_TRANSPORT_NotifyExcessBandwidth)(void *cls,
130 const struct GNUNET_PeerIdentity *neighbour);
134 * Connect to the transport service. Note that the connection may
135 * complete (or fail) asynchronously.
137 * @param cfg configuration to use
138 * @param self our own identity (API should check that it matches
139 * the identity found by transport), or NULL (no check)
140 * @param cls closure for the callbacks
141 * @param rec receive function to call, or NULL
142 * @param nc function to call on connect events, or NULL
143 * @param nd function to call on disconnect events, or NULL
144 * @param neb function to call if we have excess bandwidth to a peer
145 * @return NULL on error
147 struct GNUNET_TRANSPORT_Handle *
148 GNUNET_TRANSPORT_connect2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
149 const struct GNUNET_PeerIdentity *self,
151 GNUNET_TRANSPORT_ReceiveCallback rec,
152 GNUNET_TRANSPORT_NotifyConnect nc,
153 GNUNET_TRANSPORT_NotifyDisconnect nd,
154 GNUNET_TRANSPORT_NotifyExcessBandwidth neb);
158 * Disconnect from the transport service.
160 * @param handle handle returned from connect
163 GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle);
166 /* ************************* Sending *************************** */
169 * Opaque handle for a transmission-ready request.
171 struct GNUNET_TRANSPORT_TransmitHandle;
175 * Function called to notify a client about the connection begin ready
176 * to queue more data. @a buf will be NULL and @a size zero if the
177 * connection was closed for writing in the meantime.
180 * @param size number of bytes available in @a buf
181 * @param buf where the callee should write the message
182 * @return number of bytes written to @a buf
185 (*GNUNET_TRANSPORT_TransmitReadyNotify) (void *cls,
191 * Check if we could queue a message of the given size for
192 * transmission. The transport service will take both its internal
193 * buffers and bandwidth limits imposed by the other peer into
194 * consideration when answering this query.
196 * @param handle connection to transport service
197 * @param target who should receive the message
198 * @param size how big is the message we want to transmit?
199 * @param timeout after how long should we give up (and call
200 * notify with buf NULL and size 0)?
201 * @param notify function to call when we are ready to
202 * send such a message
203 * @param notify_cls closure for @a notify
204 * @return NULL if someone else is already waiting to be notified
205 * non-NULL if the notify callback was queued (can be used to cancel
206 * using #GNUNET_TRANSPORT_notify_transmit_ready_cancel())
208 struct GNUNET_TRANSPORT_TransmitHandle *
209 GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
210 const struct GNUNET_PeerIdentity *target,
212 struct GNUNET_TIME_Relative timeout,
213 GNUNET_TRANSPORT_TransmitReadyNotify notify,
218 * Cancel the specified transmission-ready notification.
220 * @param th handle of the transmission notification request to cancel
223 GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct GNUNET_TRANSPORT_TransmitHandle *th);
227 * Checks if a given peer is connected to us
229 * @param handle connection to transport service
230 * @param peer the peer to check
231 * @return #GNUNET_YES (connected) or #GNUNET_NO (disconnected)
234 GNUNET_TRANSPORT_check_peer_connected (struct GNUNET_TRANSPORT_Handle *handle,
235 const struct GNUNET_PeerIdentity *peer);
239 /* *********************** Metric manipulation ***************** */
242 * Set transport metrics for a peer and a direction
244 * @param handle transport handle
245 * @param peer the peer to set the metric for
246 * @param prop the performance metrics to set
247 * @param delay_in inbound delay to introduce
248 * @param delay_out outbound delay to introduce
250 * Note: Delay restrictions in receiving direction will be enforced
251 * with one message delay.
254 GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
255 const struct GNUNET_PeerIdentity *peer,
256 const struct GNUNET_ATS_Properties *prop,
257 struct GNUNET_TIME_Relative delay_in,
258 struct GNUNET_TIME_Relative delay_out);
261 /* *************************** HELLO *************************** */
265 * Function called whenever there is an update to the
266 * HELLO of this peer.
269 * @param hello our updated HELLO
272 (*GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls,
273 const struct GNUNET_MessageHeader *hello);
277 * Handle to cancel a #GNUNET_TRANSPORT_get_hello() operation.
279 struct GNUNET_TRANSPORT_GetHelloHandle;
283 * Obtain updates on changes to the HELLO message for this peer. The callback
284 * given in this function is never called synchronously.
286 * @param cfg configuration
287 * @param rec function to call with the HELLO
288 * @param rec_cls closure for @a rec
289 * @return handle to cancel the operation
291 struct GNUNET_TRANSPORT_GetHelloHandle *
292 GNUNET_TRANSPORT_get_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
293 GNUNET_TRANSPORT_HelloUpdateCallback rec,
298 * Stop receiving updates about changes to our HELLO message.
300 * @param ghh handle to cancel
303 GNUNET_TRANSPORT_get_hello_cancel (struct GNUNET_TRANSPORT_GetHelloHandle *ghh);
307 * Handle for a #GNUNET_TRANSPORT_offer_hello operation
309 struct GNUNET_TRANSPORT_OfferHelloHandle;
313 * Offer the transport service the HELLO of another peer. Note that
314 * the transport service may just ignore this message if the HELLO is
315 * malformed or useless due to our local configuration.
317 * @param cfg configuration
318 * @param hello the hello message
319 * @param cont continuation to call when HELLO has been sent,
320 * tc reason #GNUNET_SCHEDULER_REASON_TIMEOUT for fail
321 * tc reasong #GNUNET_SCHEDULER_REASON_READ_READY for success
322 * @param cont_cls closure for @a cont
323 * @return a GNUNET_TRANSPORT_OfferHelloHandle handle or NULL on failure,
324 * in case of failure @a cont will not be called
327 struct GNUNET_TRANSPORT_OfferHelloHandle *
328 GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
329 const struct GNUNET_MessageHeader *hello,
330 GNUNET_SCHEDULER_TaskCallback cont,
335 * Cancel the request to transport to offer the HELLO message
337 * @param ohh the `struct GNUNET_TRANSPORT_OfferHelloHandle` to cancel
340 GNUNET_TRANSPORT_offer_hello_cancel (struct GNUNET_TRANSPORT_OfferHelloHandle *ohh);
343 /* *********************** Address to String ******************* */
346 * Handle to cancel a pending address lookup.
348 struct GNUNET_TRANSPORT_AddressToStringContext;
352 * Function to call with a textual representation of an address. This
353 * function will be called several times with different possible
354 * textual representations, and a last time with @a address being NULL
355 * to signal the end of the iteration. Note that @a address NULL
356 * always is the last call, regardless of the value in @a res.
359 * @param address NULL on end of iteration,
360 * otherwise 0-terminated printable UTF-8 string,
361 * in particular an empty string if @a res is #GNUNET_NO
362 * @param res result of the address to string conversion:
363 * if #GNUNET_OK: conversion successful
364 * if #GNUNET_NO: address was invalid (or not supported)
365 * if #GNUNET_SYSERR: communication error (IPC error)
368 (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
374 * Convert a binary address into a human readable address.
376 * @param cfg configuration to use
377 * @param address address to convert (binary format)
378 * @param numeric should (IP) addresses be displayed in numeric form
379 * (otherwise do reverse DNS lookup)
380 * @param timeout how long is the lookup allowed to take at most
381 * @param aluc function to call with the results
382 * @param aluc_cls closure for @a aluc
383 * @return handle to cancel the operation, NULL on error
385 struct GNUNET_TRANSPORT_AddressToStringContext *
386 GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cfg,
387 const struct GNUNET_HELLO_Address *address,
389 struct GNUNET_TIME_Relative timeout,
390 GNUNET_TRANSPORT_AddressToStringCallback aluc,
395 * Cancel request for address conversion.
397 * @param alc the context handle
400 GNUNET_TRANSPORT_address_to_string_cancel (struct GNUNET_TRANSPORT_AddressToStringContext *alc);
403 /* *********************** Monitoring ************************** */
407 * Possible state of a neighbour. Initially, we are #GNUNET_TRANSPORT_PS_NOT_CONNECTED.
409 * Then, there are two main paths. If we receive a SYN message, we give
410 * the inbound address to ATS. After the check we ask ATS for a suggestion
411 * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). If ATS makes a suggestion, we
412 * send our SYN_ACK and go to #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK.
413 * If we receive a ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
414 * (and notify everyone about the new connection). If the operation times out,
415 * we go to #GNUNET_TRANSPORT_PS_DISCONNECT.
417 * The other case is where we transmit a SYN message first. We
418 * start with #GNUNET_TRANSPORT_PS_INIT_ATS. If we get an address, we send
419 * the SYN message and go to state #GNUNET_TRANSPORT_PS_CONNECT_SENT.
420 * Once we receive a SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
421 * (and notify everyone about the new connection and send
422 * back a ACK). If the operation times out, we go to
423 * #GNUNET_TRANSPORT_PS_DISCONNECT.
425 * If the session is in trouble (i.e. transport-level disconnect or
426 * timeout), we go to #GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a new
427 * address (we don't notify anyone about the disconnect yet). Once we
428 * have a new address, we enter #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a
429 * SYN message. If we receive a
430 * SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED and nobody noticed that we had
431 * trouble; we also send a ACK at this time just in case. If
432 * the operation times out, we go to #GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone
433 * about the lost connection).
435 * If ATS decides to switch addresses while we have a normal
436 * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_SYN_SENT
437 * and send a SESSION_CONNECT. If we get a ACK back, we switch the
438 * primary connection to the suggested alternative from ATS, go back
439 * to #GNUNET_TRANSPORT_PS_CONNECTED and send a ACK to the other peer just to be
440 * sure. If the operation times out
441 * we go to #GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given alternative
442 * address is "invalid").
444 * Once a session is in #GNUNET_TRANSPORT_PS_DISCONNECT, it is cleaned up and then goes
445 * to (#GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED). If we receive an explicit disconnect
446 * request, we can go from any state to #GNUNET_TRANSPORT_PS_DISCONNECT, possibly after
447 * generating disconnect notifications.
449 * Note that it is quite possible that while we are in any of these
450 * states, we could receive a 'SYN' request from the other peer.
451 * We then enter a 'weird' state where we pursue our own primary state
452 * machine (as described above), but with the 'send_connect_ack' flag
453 * set to 1. If our state machine allows us to send a 'SYN_ACK'
454 * (because we have an acceptable address), we send the 'SYN_ACK'
455 * and set the 'send_connect_ack' to 2. If we then receive a
456 * 'ACK', we go to #GNUNET_TRANSPORT_PS_CONNECTED (and reset 'send_connect_ack'
460 enum GNUNET_TRANSPORT_PeerState
463 * Fresh peer or completely disconnected
465 GNUNET_TRANSPORT_PS_NOT_CONNECTED = 0,
468 * Asked to initiate connection, trying to get address from ATS
470 GNUNET_TRANSPORT_PS_INIT_ATS,
473 * Sent SYN message to other peer, waiting for SYN_ACK
475 GNUNET_TRANSPORT_PS_SYN_SENT,
478 * Received a SYN, asking ATS about address suggestions.
480 GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
483 * SYN request from other peer was SYN_ACK'ed, waiting for ACK.
485 GNUNET_TRANSPORT_PS_SYN_RECV_ACK,
488 * Got our SYN_ACK/ACK, connection is up.
490 GNUNET_TRANSPORT_PS_CONNECTED,
493 * Connection got into trouble, rest of the system still believes
494 * it to be up, but we're getting a new address from ATS.
496 GNUNET_TRANSPORT_PS_RECONNECT_ATS,
499 * Sent SYN over new address (either by ATS telling us to switch
500 * addresses or from RECONNECT_ATS); if this fails, we need to tell
501 * the rest of the system about a disconnect.
503 GNUNET_TRANSPORT_PS_RECONNECT_SENT,
506 * We have some primary connection, but ATS suggested we switch
507 * to some alternative; we now sent a SYN message for the
508 * alternative session to the other peer and waiting for a
509 * SYN_ACK to make this our primary connection.
511 GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT,
514 * Disconnect in progress (we're sending the DISCONNECT message to the
515 * other peer; after that is finished, the state will be cleaned up).
517 GNUNET_TRANSPORT_PS_DISCONNECT,
520 * We're finished with the disconnect; and are cleaning up the state
521 * now! We put the struct into this state when we are really in the
522 * task that calls 'free' on it and are about to remove the record
523 * from the map. We should never find a 'struct NeighbourMapEntry'
524 * in this state in the map. Accessing a 'struct NeighbourMapEntry'
525 * in this state virtually always means using memory that has been
526 * freed (the exception being the cleanup code in #free_neighbour()).
528 GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED
533 * Convert a transport state to a human readable string.
535 * @param state the state
538 GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state);
542 * Check if a state is defined as connected
544 * @param state the state value
545 * @return #GNUNET_YES or #GNUNET_NO
548 GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state);
552 * Handle for a #GNUNET_TRANSPORT_monitor_peers operation.
554 struct GNUNET_TRANSPORT_PeerMonitoringContext;
558 * Function to call with information about a peer
560 * If one_shot was set to #GNUNET_YES to iterate over all peers once,
561 * a final call with NULL for peer and address will follow when done.
562 * In this case state and timeout do not contain valid values.
564 * The #GNUNET_TRANSPORT_monitor_peers_cancel() call MUST not be called from
565 * within this function!
569 * @param peer peer this update is about,
570 * NULL if this is the final last callback for a iteration operation
571 * @param address address, NULL if this is the final callback for iteration op
572 * @param state current state this peer is in
573 * @param state_timeout timeout for the current state of the peer
576 (*GNUNET_TRANSPORT_PeerIterateCallback) (void *cls,
577 const struct GNUNET_PeerIdentity *peer,
578 const struct GNUNET_HELLO_Address *address,
579 enum GNUNET_TRANSPORT_PeerState state,
580 struct GNUNET_TIME_Absolute state_timeout);
584 * Return information about a specific peer or all peers currently known to
585 * transport service once or in monitoring mode. To obtain information about
586 * a specific peer, a peer identity can be passed. To obtain information about
587 * all peers currently known to transport service, NULL can be passed as peer
590 * For each peer, the callback is called with information about the address used
591 * to communicate with this peer, the state this peer is currently in and the
592 * the current timeout for this state.
594 * Upon completion, the #GNUNET_TRANSPORT_PeerIterateCallback is called one
595 * more time with `NULL`. After this, the operation must no longer be
596 * explicitly canceled.
598 * The #GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the
601 * @param cfg configuration to use
602 * @param peer a specific peer identity to obtain information for,
604 * @param one_shot #GNUNET_YES to return the current state and then end (with NULL+NULL),
605 * #GNUNET_NO to monitor peers continuously
606 * @param peer_callback function to call with the results
607 * @param peer_callback_cls closure for @a peer_callback
609 struct GNUNET_TRANSPORT_PeerMonitoringContext *
610 GNUNET_TRANSPORT_monitor_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
611 const struct GNUNET_PeerIdentity *peer,
613 GNUNET_TRANSPORT_PeerIterateCallback peer_callback,
614 void *peer_callback_cls);
618 * Cancel request to monitor peers
620 * @param pic handle for the request to cancel
623 GNUNET_TRANSPORT_monitor_peers_cancel (struct GNUNET_TRANSPORT_PeerMonitoringContext *pic);
626 /* *********************** Blacklisting ************************ */
629 * Handle for blacklisting peers.
631 struct GNUNET_TRANSPORT_Blacklist;
635 * Function that decides if a connection is acceptable or not.
638 * @param pid peer to approve or disapproave
639 * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not
642 (*GNUNET_TRANSPORT_BlacklistCallback) (void *cls,
643 const struct GNUNET_PeerIdentity *pid);
647 * Install a blacklist callback. The service will be queried for all
648 * existing connections as well as any fresh connections to check if
649 * they are permitted. If the blacklisting callback is unregistered,
650 * all hosts that were denied in the past will automatically be
651 * whitelisted again. Cancelling the blacklist handle is also the
652 * only way to re-enable connections from peers that were previously
655 * @param cfg configuration to use
656 * @param cb callback to invoke to check if connections are allowed
657 * @param cb_cls closure for @a cb
658 * @return NULL on error, otherwise handle for cancellation
660 struct GNUNET_TRANSPORT_Blacklist *
661 GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
662 GNUNET_TRANSPORT_BlacklistCallback cb,
667 * Abort the blacklist. Note that this function is the only way for
668 * removing a peer from the blacklist.
670 * @param br handle of the request that is to be cancelled
673 GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br);
677 * Handle for a plugin session state monitor.
679 struct GNUNET_TRANSPORT_PluginMonitor;
682 * Abstract representation of a plugin's session.
683 * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
685 struct GNUNET_TRANSPORT_PluginSession;
689 * Possible states of a session in a plugin.
691 enum GNUNET_TRANSPORT_SessionState
695 * The session was created (first call for each session object).
697 GNUNET_TRANSPORT_SS_INIT,
700 * Initial session handshake is in progress.
702 GNUNET_TRANSPORT_SS_HANDSHAKE,
705 * Session is fully UP.
707 GNUNET_TRANSPORT_SS_UP,
710 * This is just an update about the session,
711 * the state did not change.
713 GNUNET_TRANSPORT_SS_UPDATE,
716 * Session is being torn down and about to disappear.
717 * Last call for each session object.
719 GNUNET_TRANSPORT_SS_DONE
725 * Information about a plugin's session.
727 struct GNUNET_TRANSPORT_SessionInfo
731 * New state of the session.
733 enum GNUNET_TRANSPORT_SessionState state;
736 * #GNUNET_YES if this is an inbound connection,
737 * #GNUNET_NO if this is an outbound connection,
738 * #GNUNET_SYSERR if connections of this plugin
739 * are so fundamentally bidirectional
740 * that they have no 'initiator'
745 * Number of messages pending transmission for this session.
747 uint32_t num_msg_pending;
750 * Number of bytes pending transmission for this session.
752 uint32_t num_bytes_pending;
755 * Until when does this plugin refuse to receive to manage
756 * staying within the inbound quota? ZERO if receive is
759 struct GNUNET_TIME_Absolute receive_delay;
762 * At what time will this session timeout (unless activity
765 struct GNUNET_TIME_Absolute session_timeout;
768 * Address used by the session. Can be NULL if none is available.
770 const struct GNUNET_HELLO_Address *address;
775 * Function called by the plugin with information about the
776 * current sessions managed by the plugin (for monitoring).
779 * @param session session handle this information is about,
780 * NULL to indicate that we are "in sync" (initial
781 * iteration complete)
782 * @param session_ctx storage location where the application
783 * can store data; will point to NULL on #GNUNET_TRANSPORT_SS_INIT,
784 * and must be reset to NULL on #GNUNET_TRANSPORT_SS_DONE
785 * @param info information about the state of the session,
786 * NULL if @a session is also NULL and we are
787 * merely signalling that the initial iteration is over;
788 * NULL with @a session being non-NULL if the monitor
789 * was being cancelled while sessions were active
792 (*GNUNET_TRANSPORT_SessionMonitorCallback) (void *cls,
793 struct GNUNET_TRANSPORT_PluginSession *session,
795 const struct GNUNET_TRANSPORT_SessionInfo *info);
799 * Install a plugin session state monitor callback. The callback
800 * will be notified whenever the session changes.
802 * @param cfg configuration to use
803 * @param cb callback to invoke on events
804 * @param cb_cls closure for @a cb
805 * @return NULL on error, otherwise handle for cancellation
807 struct GNUNET_TRANSPORT_PluginMonitor *
808 GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg,
809 GNUNET_TRANSPORT_SessionMonitorCallback cb,
814 * Cancel monitoring the plugin session state. The callback will be
815 * called once for each session that is up with the "info" argument
816 * being NULL (this is just to enable client-side cleanup).
818 * @param pm handle of the request that is to be cancelled
821 GNUNET_TRANSPORT_monitor_plugins_cancel (struct GNUNET_TRANSPORT_PluginMonitor *pm);
825 #if 0 /* keep Emacsens' auto-indent happy */
832 /* ifndef GNUNET_TRANSPORT_SERVICE_H */
835 /** @} */ /* end of group */
837 /* end of gnunet_transport_service.h */