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. Each client gets a unique handle.
39 * A peer in the GNUnet network. Each peer we care about must have one globally
40 * unique such handle within this process.
45 * Tunnel from us to another peer. There can only be at most one
51 * Entry in the message queue of a `struct CadetTunnel`.
53 struct CadetTunnelQueueEntry;
56 * A path of peer in the GNUnet network. There must only be at most
57 * once such path. Paths may share disjoint prefixes, but must all
58 * end at a unique suffix. Paths must also not be proper subsets of
59 * other existing paths.
64 * Entry in a peer path.
66 struct CadetPeerPathEntry
69 * DLL of paths where the same @e peer is at the same offset.
71 struct CadetPeerPathEntry *next;
74 * DLL of paths where the same @e peer is at the same offset.
76 struct CadetPeerPathEntry *prev;
79 * The peer at this offset of the path.
81 struct CadetPeer *peer;
84 * Path this entry belongs to.
86 struct CadetPeerPath *path;
89 * Connection using this path, or NULL for none.
91 struct CadetConnection *cc;
94 * Path's historic score up to this point. Basically, how often did
95 * we succeed or fail to use the path up to this entry in a
96 * connection. Positive values indicate good experiences, negative
97 * values bad experiences. Code updating the score must guard
106 * Active path through the network (used by a tunnel). There may
107 * be at most one connection per path.
109 struct CadetConnection;
112 * Logical end-to-end conenction between clients. There can be
113 * any number of channels between clients.
118 * Handle to the statistics service.
120 extern struct GNUNET_STATISTICS_Handle *stats;
123 * Handle to communicate with ATS.
125 extern struct GNUNET_ATS_ConnectivityHandle *ats_ch;
130 extern struct GNUNET_PeerIdentity my_full_id;
135 extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
138 * All ports clients of this peer have opened.
140 extern struct GNUNET_CONTAINER_MultiHashMap *open_ports;
143 * Map from ports to channels where the ports were closed at the
144 * time we got the inbound connection.
145 * Indexed by port, contains `struct CadetChannel`.
147 extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels;
150 * Map from PIDs to `struct CadetPeer` entries.
152 extern struct GNUNET_CONTAINER_MultiPeerMap *peers;
156 * Send a message to a client.
158 * @param c client to get the message
159 * @param env envelope with the message
162 GSC_send_to_client (struct CadetClient *c,
163 struct GNUNET_MQ_Envelope *env);
167 * Bind incoming channel to this client, and notify client
168 * about incoming connection.
170 * @param c client to bind to
171 * @param ch channel to be bound
172 * @param dest peer that establishes the connection
173 * @param port port number
174 * @param options options
175 * @return local channel number assigned to the new client
177 struct GNUNET_CADET_ClientChannelNumber
178 GSC_bind (struct CadetClient *c,
179 struct CadetChannel *ch,
180 struct CadetPeer *dest,
181 const struct GNUNET_HashCode *port,
186 * Return identifier for a client as a string.
188 * @param c client to identify
189 * @return string for debugging
192 GSC_2s (struct CadetClient *c);