GNUnet  0.10.x
gnunet-service-cadet_connection.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 
30 #ifndef GNUNET_SERVICE_CADET_CONNECTION_H
31 #define GNUNET_SERVICE_CADET_CONNECTION_H
32 
33 #include "gnunet_util_lib.h"
34 #include "gnunet-service-cadet.h"
36 #include "cadet_protocol.h"
37 
38 
46 typedef void
47 (*GCC_ReadyCallback)(void *cls,
48  int is_ready);
49 
50 
59 void
61 
62 
70 void
72 
73 
80 struct CadetConnection *
82 
83 
96 struct CadetConnection *
98  struct CadetPeerPath *path,
99  unsigned int off,
100  struct CadetTConnection *ct,
102  void *ready_cb_cls);
103 
104 
118 struct CadetConnection *
120  struct CadetPeerPath *path,
121  struct CadetTConnection *ct,
124  void *ready_cb_cls);
125 
126 
139 void
140 GCC_transmit(struct CadetConnection *cc,
141  struct GNUNET_MQ_Envelope *env);
142 
143 
149 void
151 
152 
160 void
162 
163 
170 void
171 GCC_handle_kx(struct CadetConnection *cc,
173 
174 
181 void
184 
185 
195 
201 
207 
212  unsigned long long num_acked_transmissions;
213 
221  unsigned long long num_successes;
222 };
223 
224 
231 const struct CadetConnectionMetrics *
232 GCC_get_metrics(struct CadetConnection *cc);
233 
234 
241 void
244 
245 
252 void
254 
255 
264 void
266 
267 
276 void
278  struct GNUNET_TIME_Relative latency);
279 
280 
287 struct CadetTConnection *
288 GCC_get_ct(struct CadetConnection *cc);
289 
290 
298 struct CadetPeerPath *
299 GCC_get_path(struct CadetConnection *cc,
300  unsigned int *off);
301 
302 
310 GCC_get_id(struct CadetConnection *cc);
311 
312 
318 const char *
319 GCC_2s(const struct CadetConnection *cc);
320 
321 
328 void
329 GCC_debug(struct CadetConnection *cc,
330  enum GNUNET_ErrorType level);
331 
332 
333 #endif
Axolotl-encrypted tunnel message with application payload.
void GCC_destroy_without_core(struct CadetConnection *cc)
Destroy a connection, called when the CORE layer is already done (i.e.
Peer description.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
Low-level connection to a destination.
void GCC_ack_observed(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
We observed an ACK for a message that was originally sent via the connection identified by cti...
const char * GCC_2s(const struct CadetConnection *cc)
Get a (static) string for a connection.
void GCC_latency_observed(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, struct GNUNET_TIME_Relative latency)
We observed some the given latency on the connection identified by cti.
void GCC_destroy_without_tunnel(struct CadetConnection *cc)
Destroy a connection, called if the tunnel association with the connection was already broken...
unsigned long long num_successes
Number of packets that were sent via this connection did actually receive an ACK? (Note: ACKs may be ...
struct GNUNET_TIME_Absolute last_use
When was this connection last used? (by us sending or receiving a PAYLOAD message on it) ...
void GCC_handle_encrypted(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Handle encrypted message.
const struct CadetConnectionMetrics * GCC_get_metrics(struct CadetConnection *cc)
Obtain performance metrics from cc.
struct CadetPeerPath * path
Path we are using to our destination.
struct GNUNET_CADET_ConnectionTunnelIdentifier cid
ID of the connection.
void GCC_handle_connection_create_ack(struct CadetConnection *cc)
A CREATE_ACK was received for this connection, process it.
struct CadetPeer * destination
To which peer does this connection go?
void GCC_ack_expected(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
We sent a message for which we expect to receive an ACK via the connection identified by cti...
GNUNET_ErrorType
Types of errors.
GCC_ReadyCallback ready_cb
Function to call once we are ready to transmit.
Performance metrics for a connection.
struct CadetConnection * GCC_create(struct CadetPeer *destination, struct CadetPeerPath *path, unsigned int off, struct CadetTConnection *ct, GCC_ReadyCallback ready_cb, void *ready_cb_cls)
Create a connection to destination via path and notify cb whenever we are ready for more data...
Information we track per peer.
void GCC_handle_kx_auth(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg)
Handle KX_AUTH message.
Message for a Key eXchange for a tunnel, with authentication.
struct CadetConnection * GCC_lookup(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
Lookup a connection by its identifier.
struct GNUNET_TIME_Relative aged_latency
Our current best estimate of the latency, based on a weighted average of at least latency_datapoints ...
struct CadetTConnection * ct
Which tunnel is using this connection?
struct CadetConnection * cc
Connection handle.
const struct GNUNET_CADET_ConnectionTunnelIdentifier * GCC_get_id(struct CadetConnection *cc)
Obtain unique ID for the connection.
void GCC_handle_kx(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
Handle KX message.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
void GCC_transmit(struct CadetConnection *cc, struct GNUNET_MQ_Envelope *env)
Transmit message msg via connection cc.
P2P messages used by CADET.
void(* GCC_ReadyCallback)(void *cls, int is_ready)
Function called to notify tunnel about change in our readyness.
void GCC_debug(struct CadetConnection *cc, enum GNUNET_ErrorType level)
Log connection info.
struct CadetPeerPath * GCC_get_path(struct CadetConnection *cc, unsigned int *off)
Obtain the path used by this connection.
Entry in list of connections used by tunnel, with metadata.
void * ready_cb_cls
Closure for ready_cb.
Hash uniquely identifying a connection below a tunnel.
struct CadetTConnection * GCC_get_ct(struct CadetConnection *cc)
Return the tunnel associated with this connection.
Message for a Key eXchange for a tunnel.
unsigned long long num_acked_transmissions
How many packets that ought to generate an ACK did we send via this connection?
Time for absolute times used by GNUnet, in microseconds.
struct CadetConnection * GCC_create_inbound(struct CadetPeer *destination, struct CadetPeerPath *path, struct CadetTConnection *ct, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, GCC_ReadyCallback ready_cb, void *ready_cb_cls)
Create a connection to destination via path and notify cb whenever we are ready for more data...
struct GNUNET_TIME_Absolute age
When was this connection first established? (by us sending or receiving the CREATE_ACK for the first ...
Information regarding a possible path to reach a peer.
Time for relative time used by GNUnet, in microseconds.
unsigned int off
Offset of our destination in path.
void GCC_handle_duplicate_create(struct CadetConnection *cc)
We got a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a connection that we already have...
Information we track per peer.