3 This file is part of GNUnet.
4 Copyright (C) 2001-2017 GNUnet e.V.
6 GNUnet is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3, or (at your
9 option) any later version.
11 GNUnet is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNUnet; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
23 * @file cadet/gnunet-service-cadet-new.h
24 * @brief Information we track per peer.
25 * @author Bartlomiej Polot
26 * @author Christian Grothoff
28 #ifndef GNUNET_SERVICE_CADET_H
29 #define GNUNET_SERVICE_CADET_H
31 #include "gnunet_util_lib.h"
34 * A client to the CADET service.
39 * A peer in the GNUnet network.
44 * Tunnel from us to another peer.
49 * Entry in the message queue of a `struct CadetTunnel`
51 struct CadetTunnelQueueEntry;
54 * A path of peer in the GNUnet network.
59 * Entry in a peer path.
61 struct CadetPeerPathEntry
64 * DLL of paths where the same @e peer is at the same offset.
66 struct CadetPeerPathEntry *next;
69 * DLL of paths where the same @e peer is at the same offset.
71 struct CadetPeerPathEntry *prev;
74 * The peer at this offset of the path.
76 struct CadetPeer *peer;
79 * Path this entry belongs to.
81 struct CadetPeerPath *path;
84 * Path's historic score up to this point. Basically, how often did
85 * we succeed or fail to use the path up to this entry in a
86 * connection. Positive values indicate good experiences, negative
87 * values bad experiences. Code updating the score must guard
96 * Active path through the network (used by a tunnel).
98 struct CadetConnection;
101 * Logical end-to-end conenction between clients.
106 * Handle to the statistics service.
108 extern struct GNUNET_STATISTICS_Handle *stats;
111 * Handle to communicate with ATS.
113 extern struct GNUNET_ATS_ConnectivityHandle *ats_ch;
118 extern struct GNUNET_PeerIdentity my_full_id;
123 extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
126 * All ports clients of this peer have opened.
128 extern struct GNUNET_CONTAINER_MultiHashMap *open_ports;
131 * Map from ports to channels where the ports were closed at the
132 * time we got the inbound connection.
133 * Indexed by port, contains `struct CadetChannel`.
135 extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels;
138 * Map from PIDs to `struct CadetPeer` entries.
140 extern struct GNUNET_CONTAINER_MultiPeerMap *peers;
144 * Send a message to a client.
146 * @param c client to get the message
147 * @param env envelope with the message
150 GSC_send_to_client (struct CadetClient *c,
151 struct GNUNET_MQ_Envelope *env);
155 * Bind incoming channel to this client, and notify client
156 * about incoming connection.
158 * @param c client to bind to
159 * @param ch channel to be bound
160 * @param dest peer that establishes the connection
161 * @param port port number
162 * @param options options
163 * @return local channel number assigned to the new client
165 struct GNUNET_CADET_ClientChannelNumber
166 GSC_bind (struct CadetClient *c,
167 struct CadetChannel *ch,
168 struct CadetPeer *dest,
169 const struct GNUNET_HashCode *port,
174 * Return identifier for a client as a string.
176 * @param c client to identify
177 * @return string for debugging
180 GSC_2s (struct CadetClient *c);