GNUnet  0.11.x
gnunet-service-cadet_tunnels.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_TUNNELS_H
28 #define GNUNET_SERVICE_CADET_TUNNELS_H
29 
30 #include "gnunet-service-cadet.h"
31 #include "cadet_protocol.h"
32 
33 
37 #define DESIRED_CONNECTIONS_PER_TUNNEL 3
38 
39 
44 {
50 
55 
60 
65 
76 
81 };
82 
89 int
90 GCT_alice_or_betty (const struct GNUNET_PeerIdentity *other);
91 
99 const char *
100 GCT_2s (const struct CadetTunnel *t);
101 
102 
110 struct CadetTunnel *
112 
113 
119 void
121 
122 
132 int
134  const struct
136  struct CadetPeerPath *path);
137 
138 
145 void
147 
148 
155 struct CadetPeer *
157 
158 
167 void
169  struct CadetPeerPath *p,
170  unsigned int off);
171 
172 
181 GCT_add_channel (struct CadetTunnel *t,
182  struct CadetChannel *ch);
183 
184 
192 void
194  struct CadetChannel *ch,
196 
197 
204 void
207 
208 
217 typedef void
218 (*GCT_SendContinuation)(void *cls,
219  const struct
221 
222 
233 struct CadetTunnelQueueEntry *
234 GCT_send (struct CadetTunnel *t,
235  const struct GNUNET_MessageHeader *message,
237  void *cont_cls,
239 
240 
250 void
252 
253 
260 unsigned int
262 
263 
270 unsigned int
271 GCT_count_any_connections (const struct CadetTunnel *t);
272 
273 
280 typedef void
281 (*GCT_ConnectionIterator) (void *cls,
282  struct CadetTConnection *ct);
283 
284 
292 void
295  void *iter_cls);
296 
297 
304 typedef void
305 (*GCT_ChannelIterator) (void *cls,
306  struct CadetChannel *ch);
307 
308 
316 void
318  GCT_ChannelIterator iter,
319  void *iter_cls);
320 
321 
330 GCT_get_estate (struct CadetTunnel *t);
331 
339 void
341  enum CadetTunnelEState state);
342 
349 void
350 GCT_handle_kx (struct CadetTConnection *ct,
352 
353 
360 void
362  const struct
364 
365 
372 void
375 
376 
383 void
384 GCT_debug (const struct CadetTunnel *t,
385  enum GNUNET_ErrorType level);
386 
387 
388 #endif
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
P2P messages used by CADET.
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
enum State state
current state of profiling
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
Information we track per peer.
void GCT_handle_kx(struct CadetTConnection *ct, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
Handle KX message.
void GCT_remove_channel(struct CadetTunnel *t, struct CadetChannel *ch, struct GNUNET_CADET_ChannelTunnelNumber ctn)
Remove a channel from a tunnel.
void GCT_send_channel_destroy(struct CadetTunnel *t, struct GNUNET_CADET_ChannelTunnelNumber ctn)
Send a DESTROY message via the tunnel.
const char * GCT_2s(const struct CadetTunnel *t)
Get the static string for the peer this tunnel is directed.
unsigned int GCT_count_any_connections(const struct CadetTunnel *t)
Return the number of connections available for a tunnel.
void GCT_change_estate(struct CadetTunnel *t, enum CadetTunnelEState state)
Change the tunnel encryption state.
unsigned int GCT_count_channels(struct CadetTunnel *t)
Return the number of channels using a tunnel.
void GCT_handle_kx_auth(struct CadetTConnection *ct, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg)
Handle KX_AUTH message.
void GCT_iterate_connections(struct CadetTunnel *t, GCT_ConnectionIterator iter, void *iter_cls)
Iterate over all connections of a tunnel.
void GCT_handle_encrypted(struct CadetTConnection *ct, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Handle encrypted message.
CadetTunnelEState
All the encryption states a tunnel can be in.
@ CADET_TUNNEL_KEY_AX_AUTH_SENT
KX received and we sent KX_AUTH back, but we got no traffic yet, so we're waiting for either KX_AUTH ...
@ CADET_TUNNEL_KEY_AX_SENT
KX message sent, waiting for other peer's KX_AUTH.
@ CADET_TUNNEL_KEY_UNINITIALIZED
Uninitialized status, we need to send KX.
@ CADET_TUNNEL_KEY_AX_SENT_AND_RECV
KX message sent and received, trying to send back KX_AUTH.
@ CADET_TUNNEL_KEY_OK
Handshake completed: session key available.
@ CADET_TUNNEL_KEY_AX_RECV
KX message received, trying to send back KX_AUTH.
struct GNUNET_CADET_ChannelTunnelNumber GCT_add_channel(struct CadetTunnel *t, struct CadetChannel *ch)
Add a channel to a tunnel.
struct CadetTunnel * GCT_create_tunnel(struct CadetPeer *destination)
Create a tunnel to destination.
int GCT_add_inbound_connection(struct CadetTunnel *t, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, struct CadetPeerPath *path)
Add a connection to the tunnel.
void GCT_connection_lost(struct CadetTConnection *ct)
We lost a connection, remove it from our list and clean up the connection object itself.
enum CadetTunnelEState GCT_get_estate(struct CadetTunnel *t)
Get the encryption state of a tunnel.
struct CadetTunnelQueueEntry * GCT_send(struct CadetTunnel *t, const struct GNUNET_MessageHeader *message, GCT_SendContinuation cont, void *cont_cls, struct GNUNET_CADET_ChannelTunnelNumber *ctn)
Sends an already built message on a tunnel, encrypting it and choosing the best connection if not pro...
void GCT_destroy_tunnel_now(struct CadetTunnel *t)
Destroys the tunnel t now, without delay.
void(* GCT_ConnectionIterator)(void *cls, struct CadetTConnection *ct)
Iterator over connections.
int GCT_alice_or_betty(const struct GNUNET_PeerIdentity *other)
Am I Alice or Betty (some call her Bob), or talking to myself?
struct CadetPeer * GCT_get_destination(struct CadetTunnel *t)
Return the peer to which this tunnel goes.
void GCT_consider_path(struct CadetTunnel *t, struct CadetPeerPath *p, unsigned int off)
Consider using the path p for the tunnel t.
void(* GCT_SendContinuation)(void *cls, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
Function called when a transmission requested using GCT_send is done.
void(* GCT_ChannelIterator)(void *cls, struct CadetChannel *ch)
Iterator over channels.
void GCT_iterate_channels(struct CadetTunnel *t, GCT_ChannelIterator iter, void *iter_cls)
Iterate over all channels of a tunnel.
void GCT_debug(const struct CadetTunnel *t, enum GNUNET_ErrorType level)
Log all possible info about the tunnel state.
void GCT_send_cancel(struct CadetTunnelQueueEntry *q)
Cancel a previously sent message while it's in the queue.
static struct GNUNET_SCHEDULER_Task * t
Main task.
GNUNET_ErrorType
Types of errors.
Struct containing all information regarding a channel to a remote client.
struct GNUNET_CADET_ChannelTunnelNumber ctn
Number identifying this channel in its tunnel.
Information regarding a possible path to reach a peer.
Peer description.
Entry in list of connections used by tunnel, with metadata.
Struct used to save messages in a non-ready tunnel to send once connected.
GCT_SendContinuation cont
Continuation to call once sent (on the channel layer).
void * cont_cls
Closure for cont.
Struct containing all information regarding a tunnel to a peer.
struct CadetPeer * destination
Destination of the tunnel.
Number identifying a CADET channel within a tunnel.
Hash uniquely identifying a connection below a tunnel.
Axolotl-encrypted tunnel message with application payload.
Message for a Key eXchange for a tunnel, with authentication.
Message for a Key eXchange for a tunnel.
Header for all communications.
The identity of the host (wraps the signing key of the peer).