GNUnet 0.22.2
gnunet-service-cadet.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001-2017 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
27#ifndef GNUNET_SERVICE_CADET_H
28#define GNUNET_SERVICE_CADET_H
29
30#include "gnunet_util_lib.h"
31#include "cadet_protocol.h"
32
36struct CadetClient;
37
42struct CadetPeer;
43
48struct CadetTunnel;
49
54
61struct CadetPeerPath;
62
67{
72
77
81 struct CadetPeer *peer;
82
87
92
100 int score;
101};
102
107{
112
117
122
126 struct CadetTunnel *t;
127
132
136 uint32_t throughput;
137
142};
143
144
149{
153 struct CadetClient *c;
154
159
164};
165
166
171struct CadetConnection;
172
181struct CadetRoute;
182
187struct CadetChannel;
188
192extern const struct GNUNET_CONFIGURATION_Handle *cfg;
193
197extern struct GNUNET_STATISTICS_Handle *stats;
198
203
207extern struct GNUNET_PeerIdentity my_full_id;
208
213
219
225
232
237
241extern unsigned long long ratchet_messages;
242
247
252
256extern int shutting_down;
257
261extern unsigned long long drop_percent;
262
263
270void
272 struct GNUNET_MQ_Envelope *env);
273
274
282void
285 struct CadetChannel *ch);
286
294void
295GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port,
296 struct CadetChannel *ch);
297
298
311GSC_bind (struct CadetClient *c,
312 struct CadetChannel *ch,
313 struct CadetPeer *dest,
314 const struct GNUNET_HashCode *port,
315 uint32_t options);
316
317
324const char *
325GSC_2s (struct CadetClient *c);
326
327
328#endif
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
P2P messages used by CADET.
static uint16_t port
Port number.
Definition: gnunet-bcd.c:146
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
struct GNUNET_CONTAINER_MultiPeerMap * peers
Map from PIDs to struct CadetPeer entries.
struct GNUNET_CONTAINER_MultiShortmap * connections
Map from struct GNUNET_CADET_ConnectionTunnelIdentifier hash codes to struct CadetConnection objects.
struct GNUNET_PeerIdentity my_full_id
Local peer own ID.
void GSC_handle_remote_channel_destroy(struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn, struct CadetChannel *ch)
A channel was destroyed by the other peer.
unsigned long long drop_percent
Set to non-zero values to create random drops to test retransmissions.
struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
const struct GNUNET_CONFIGURATION_Handle * cfg
Handle to our configuration.
struct GNUNET_TIME_Relative keepalive_period
How frequently do we send KEEPALIVE messages on idle connections?
void GSC_send_to_client(struct CadetClient *c, struct GNUNET_MQ_Envelope *env)
Send a message to a client.
int shutting_down
Signal that shutdown is happening: prevent recovery measures.
unsigned long long ratchet_messages
How many messages are needed to trigger an AXOLOTL ratchet advance.
struct GNUNET_TRANSPORT_ApplicationHandle * transport
Handle to Transport service.
struct GNUNET_CONTAINER_MultiHashMap * open_ports
All ports clients of this peer have opened.
struct GNUNET_CADET_ClientChannelNumber GSC_bind(struct CadetClient *c, struct CadetChannel *ch, struct CadetPeer *dest, const struct GNUNET_HashCode *port, uint32_t options)
Bind incoming channel to this client, and notify client about incoming connection.
struct GNUNET_CONTAINER_MultiHashMap * loose_channels
Map from ports to channels where the ports were closed at the time we got the inbound connection.
struct GNUNET_CRYPTO_EddsaPrivateKey * my_private_key
Own private key.
struct GNUNET_TIME_Relative ratchet_time
How long until we trigger a ratched advance due to time.
void GSC_drop_loose_channel(const struct GNUNET_HashCode *h_port, struct CadetChannel *ch)
A client that created a loose channel that was not bound to a port disconnected, drop it from the loo...
const char * GSC_2s(struct CadetClient *c)
Return identifier for a client as a string.
Struct containing all information regarding a channel to a remote client.
Struct containing information about a client of the service.
Low-level connection to a destination.
Entry in a peer path.
struct CadetPeerPathEntry * next
DLL of paths where the same peer is at the same offset.
int score
Path's historic score up to this point.
struct CadetPeer * peer
The peer at this offset of the path.
struct CadetConnection * cc
Connection using this path, or NULL for none.
struct CadetPeerPathEntry * prev
DLL of paths where the same peer is at the same offset.
struct CadetPeerPath * path
Path this entry belongs to.
Information regarding a possible path to reach a peer.
Struct containing all information regarding a given peer.
Entry in list of connections used by tunnel, with metadata.
struct CadetTConnection * prev
Prev in DLL.
struct CadetTConnection * next
Next in DLL.
struct CadetConnection * cc
Connection handle.
struct GNUNET_TIME_Absolute created
Creation time, to keep oldest connection alive.
int is_ready
Is the connection currently ready for transmission?
uint32_t throughput
Connection throughput, to keep fastest connection alive.
struct CadetTunnel * t
Tunnel this connection belongs to.
Struct used to save messages in a non-ready tunnel to send once connected.
Struct containing all information regarding a tunnel to a peer.
Number uniquely identifying a channel of a client.
Definition: cadet.h:101
Internal representation of the hash map.
Internal representation of the hash map.
Internal representation of the hash map.
Private ECC key encoded for transmission.
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
Handle for the service.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
Handle to the TRANSPORT subsystem for application management.
Port opened by a client.
struct GNUNET_HashCode port
Port number.
struct GNUNET_HashCode h_port
Port hashed with our PID (matches incoming OPEN messages).
struct CadetClient * c
Client that opened the port.