GNUnet  0.19.4
gnunet_transport_service.h
Go to the documentation of this file.
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 
38 #ifndef GNUNET_TRANSPORT_SERVICE_H
39 #define GNUNET_TRANSPORT_SERVICE_H
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #if 0 /* keep Emacsens' auto-indent happy */
44 }
45 #endif
46 #endif
47 
48 
49 #include "gnunet_util_lib.h"
50 #include "gnunet_ats_service.h"
51 
55 #define GNUNET_TRANSPORT_VERSION 0x00000003
56 
57 
58 /* *************************** HELLO *************************** */
59 
64 
65 
83  const struct GNUNET_MessageHeader *hello,
85  void *cont_cls);
86 
87 
93 void
96 
97 
98 /* *********************** Address to String ******************* */
99 
104 
105 
122 typedef void
124  const char *address,
125  int res);
126 
127 
142  const struct GNUNET_CONFIGURATION_Handle *cfg,
143  const struct GNUNET_HELLO_Address *address,
144  int numeric,
147  void *aluc_cls);
148 
149 
155 void
158 
159 
160 /* *********************** Monitoring ************************** */
161 
162 
220 {
225 
230 
235 
240 
245 
250 
256 
263 
271 
277 
288 };
289 
290 
296 const char *
298 
299 
306 int
308 
309 
314 
315 
334 typedef void
336  void *cls,
337  const struct GNUNET_PeerIdentity *peer,
338  const struct GNUNET_HELLO_Address *address,
340  struct GNUNET_TIME_Absolute state_timeout);
341 
342 
372  const struct GNUNET_CONFIGURATION_Handle *cfg,
373  const struct GNUNET_PeerIdentity *peer,
374  int one_shot,
376  void *peer_callback_cls);
377 
378 
384 void
387 
388 
389 /* *********************** Blacklisting ************************ */
390 
395 
396 
404 typedef int
406  void *cls,
407  const struct GNUNET_PeerIdentity *pid);
408 
409 
427  void *cb_cls);
428 
429 
436 void
438 
439 
444 
450 
451 
456 {
461 
466 
471 
477 
483 };
484 
485 
490 {
495 
504 
508  uint32_t num_msg_pending;
509 
514 
521 
527 
532 };
533 
534 
552 typedef void
554  void *cls,
555  struct GNUNET_TRANSPORT_PluginSession *session,
556  void **session_ctx,
557  const struct GNUNET_TRANSPORT_SessionInfo *info);
558 
559 
572  void *cb_cls);
573 
574 
582 void
585 
586 
591 
592 
605 typedef void *
606 (*GNUNET_TRANSPORT_NotifyConnect) (
607  void *cls,
608  const struct GNUNET_PeerIdentity *peer,
609  struct GNUNET_MQ_Handle *mq);
610 
611 
623 typedef void
625  void *cls,
626  const struct GNUNET_PeerIdentity *peer,
627  void *handler_cls);
628 
629 
646 typedef void
648  void *cls,
649  const struct GNUNET_PeerIdentity *neighbour,
650  void *handlers_cls);
651 
652 
672  const struct GNUNET_PeerIdentity *self,
673  const struct GNUNET_MQ_MessageHandler *handlers,
674  void *cls,
678 
679 
685 void
687 
688 
696 struct GNUNET_MQ_Handle *
698  const struct GNUNET_PeerIdentity *peer);
699 
700 
701 #if 0 /* keep Emacsens' auto-indent happy */
702 {
703 #endif
704 #ifdef __cplusplus
705 }
706 #endif
707 
708 /* ifndef GNUNET_TRANSPORT_SERVICE_H */
709 #endif
710  /* end of group */
712  /* end of group addition */
714 
715 /* end of gnunet_transport_service.h */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static int res
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static char * address
GNS address for this phone.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
enum State state
current state of profiling
#define info
static struct GNUNET_PEERINFO_NotifyContext * nc
Iterator context.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static int numeric
Option -n.
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
Automatic transport selection and outbound bandwidth determination.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
void GNUNET_TRANSPORT_monitor_plugins_cancel(struct GNUNET_TRANSPORT_PluginMonitor *pm)
Cancel monitoring the plugin session state.
struct GNUNET_MQ_Handle * GNUNET_TRANSPORT_core_get_mq(struct GNUNET_TRANSPORT_CoreHandle *handle, const struct GNUNET_PeerIdentity *peer)
Checks if a given peer is connected to us and get the message queue.
int(* GNUNET_TRANSPORT_BlacklistCallback)(void *cls, const struct GNUNET_PeerIdentity *pid)
Function that decides if a connection is acceptable or not.
void GNUNET_TRANSPORT_offer_hello_cancel(struct GNUNET_TRANSPORT_OfferHelloHandle *ohh)
Cancel the request to transport to offer the HELLO message.
void *(* GNUNET_TRANSPORT_NotifyConnect)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Function called to notify transport users that another peer connected to us.
void(* GNUNET_TRANSPORT_AddressToStringCallback)(void *cls, const char *address, int res)
Function to call with a textual representation of an address.
struct GNUNET_TRANSPORT_AddressToStringContext * GNUNET_TRANSPORT_address_to_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HELLO_Address *address, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressToStringCallback aluc, void *aluc_cls)
Convert a binary address into a human readable address.
GNUNET_TRANSPORT_SessionState
Possible states of a session in a plugin.
const char * GNUNET_TRANSPORT_ps2s(enum GNUNET_TRANSPORT_PeerState state)
Convert a transport state to a human readable string.
struct GNUNET_TRANSPORT_OfferHelloHandle * GNUNET_TRANSPORT_offer_hello(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_MessageHeader *hello, GNUNET_SCHEDULER_TaskCallback cont, void *cont_cls)
Offer the transport service the HELLO of another peer.
void(* GNUNET_TRANSPORT_SessionMonitorCallback)(void *cls, struct GNUNET_TRANSPORT_PluginSession *session, void **session_ctx, const struct GNUNET_TRANSPORT_SessionInfo *info)
Function called by the plugin with information about the current sessions managed by the plugin (for ...
void(* GNUNET_TRANSPORT_NotifyDisconnect)(void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls)
Function called to notify transport users that another peer disconnected from us.
void GNUNET_TRANSPORT_address_to_string_cancel(struct GNUNET_TRANSPORT_AddressToStringContext *alc)
Cancel request for address conversion.
struct GNUNET_TRANSPORT_Blacklist * GNUNET_TRANSPORT_blacklist(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_TRANSPORT_BlacklistCallback cb, void *cb_cls)
Install a blacklist callback.
void GNUNET_TRANSPORT_monitor_peers_cancel(struct GNUNET_TRANSPORT_PeerMonitoringContext *pic)
Cancel request to monitor peers.
struct GNUNET_TRANSPORT_PeerMonitoringContext * GNUNET_TRANSPORT_monitor_peers(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *peer, int one_shot, GNUNET_TRANSPORT_PeerIterateCallback peer_callback, void *peer_callback_cls)
Return information about a specific peer or all peers currently known to transport service once or in...
struct GNUNET_TRANSPORT_PluginMonitor * GNUNET_TRANSPORT_monitor_plugins(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_TRANSPORT_SessionMonitorCallback cb, void *cb_cls)
Install a plugin session state monitor callback.
void(* GNUNET_TRANSPORT_NotifyExcessBandwidth)(void *cls, const struct GNUNET_PeerIdentity *neighbour, void *handlers_cls)
Function called if we have "excess" bandwidth to a peer.
GNUNET_TRANSPORT_PeerState
Possible state of a neighbour.
struct GNUNET_TRANSPORT_CoreHandle * GNUNET_TRANSPORT_core_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *self, const struct GNUNET_MQ_MessageHandler *handlers, void *cls, GNUNET_TRANSPORT_NotifyConnect nc, GNUNET_TRANSPORT_NotifyDisconnect nd, GNUNET_TRANSPORT_NotifyExcessBandwidth neb)
Connect to the transport service.
void(* GNUNET_TRANSPORT_PeerIterateCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout)
Function to call with information about a peer.
void GNUNET_TRANSPORT_blacklist_cancel(struct GNUNET_TRANSPORT_Blacklist *br)
Abort the blacklist.
void GNUNET_TRANSPORT_core_disconnect(struct GNUNET_TRANSPORT_CoreHandle *handle)
Disconnect from the transport service.
int GNUNET_TRANSPORT_is_connected(enum GNUNET_TRANSPORT_PeerState state)
Check if a state is defined as connected.
@ GNUNET_TRANSPORT_SS_INIT
The session was created (first call for each session object).
@ GNUNET_TRANSPORT_SS_HANDSHAKE
Initial session handshake is in progress.
@ GNUNET_TRANSPORT_SS_DONE
Session is being torn down and about to disappear.
@ GNUNET_TRANSPORT_SS_UP
Session is fully UP.
@ GNUNET_TRANSPORT_SS_UPDATE
This is just an update about the session, the state did not change.
@ GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED
We're finished with the disconnect; and are cleaning up the state now! We put the struct into this st...
@ GNUNET_TRANSPORT_PS_NOT_CONNECTED
Fresh peer or completely disconnected.
@ GNUNET_TRANSPORT_PS_INIT_ATS
Asked to initiate connection, trying to get address from ATS.
@ GNUNET_TRANSPORT_PS_SYN_RECV_ATS
Received a SYN, asking ATS about address suggestions.
@ GNUNET_TRANSPORT_PS_SYN_RECV_ACK
SYN request from other peer was SYN_ACK'ed, waiting for ACK.
@ GNUNET_TRANSPORT_PS_RECONNECT_SENT
Sent SYN over new address (either by ATS telling us to switch addresses or from RECONNECT_ATS); if th...
@ GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT
We have some primary connection, but ATS suggested we switch to some alternative; we now sent a SYN m...
@ GNUNET_TRANSPORT_PS_CONNECTED
Got our SYN_ACK/ACK, connection is up.
@ GNUNET_TRANSPORT_PS_SYN_SENT
Sent SYN message to other peer, waiting for SYN_ACK.
@ GNUNET_TRANSPORT_PS_RECONNECT_ATS
Connection got into trouble, rest of the system still believes it to be up, but we're getting a new a...
@ GNUNET_TRANSPORT_PS_DISCONNECT
Disconnect in progress (we're sending the DISCONNECT message to the other peer; after that is finishe...
An address for communicating with a peer.
Handle to a message queue.
Definition: mq.c:87
Message handler for a specific message type.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
Handle for blacklisting requests.
GNUNET_TRANSPORT_BlacklistCallback cb
Function to call for determining if a peer is allowed to communicate with us.
Handle for the transport service (includes all of the state for the transport service).
void * cls
Closure for the callbacks.
Entry in linked list for all offer-HELLO requests.
GNUNET_SCHEDULER_TaskCallback cont
Function to call once we are done.
Context for iterating validation entries.
Handle for a plugin session state monitor.
GNUNET_TRANSPORT_SessionMonitorCallback cb
Callback to call.
Abstract representation of a plugin's session.
Information about a plugin's session.
struct GNUNET_TIME_Absolute receive_delay
Until when does this plugin refuse to receive to manage staying within the inbound quota?...
const struct GNUNET_HELLO_Address * address
Address used by the session.
int is_inbound
GNUNET_YES if this is an inbound connection, GNUNET_NO if this is an outbound connection,...
struct GNUNET_TIME_Absolute session_timeout
At what time will this session timeout (unless activity happens)?
uint32_t num_bytes_pending
Number of bytes pending transmission for this session.
enum GNUNET_TRANSPORT_SessionState state
New state of the session.
uint32_t num_msg_pending
Number of messages pending transmission for this session.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.