GNUnet  0.11.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
183  const struct
185 
190 {
191 
196 
210 
211 };
212 
217 {
223 
228  struct GNUNET_TIME_Absolute age;
229 
235 
240  unsigned long long num_acked_transmissions;
241 
249  unsigned long long num_successes;
250 };
251 
252 
259 const struct CadetConnectionMetrics *
260 GCC_get_metrics (struct CadetConnection *cc);
261 
262 
269 void
272 
273 
280 void
282 
283 
292 void
294 
295 
304 void
306  struct GNUNET_TIME_Relative latency);
307 
308 
315 struct CadetTConnection *
316 GCC_get_ct (struct CadetConnection *cc);
317 
318 
326 struct CadetPeerPath *
327 GCC_get_path (struct CadetConnection *cc,
328  unsigned int *off);
329 
330 
338 GCC_get_id (struct CadetConnection *cc);
339 
340 
346 const char *
347 GCC_2s (const struct CadetConnection *cc);
348 
349 
356 void
358  enum GNUNET_ErrorType level);
359 
360 
361 #endif
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
P2P messages used by CADET.
Information we track per peer.
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_handle_encrypted(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelEncryptedMessage *msg)
Handle encrypted message.
void GCC_handle_connection_create_ack(struct CadetConnection *cc)
A CREATE_ACK was received for this connection, process it.
struct CadetTConnection * GCC_get_ct(struct CadetConnection *cc)
Return the tunnel associated with this connection.
void GCC_handle_kx(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg)
Handle KX message.
void GCC_destroy_without_core(struct CadetConnection *cc)
Destroy a connection, called when the CORE layer is already done (i.e.
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.
const struct CadetConnectionMetrics * GCC_get_metrics(struct CadetConnection *cc)
Obtain performance metrics from cc.
void GCC_handle_kx_auth(struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg)
Handle KX_AUTH message.
struct CadetPeerPath * GCC_get_path(struct CadetConnection *cc, unsigned int *off)
Obtain the path used by this connection.
struct CadetConnection * GCC_lookup(const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid)
Lookup a connection by its identifier.
void GCC_handle_duplicate_create(struct CadetConnection *cc)
We got a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a connection that we already have.
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.
void GCC_destroy_without_tunnel(struct CadetConnection *cc)
Destroy a connection, called if the tunnel association with the connection was already broken,...
void GCC_transmit(struct CadetConnection *cc, struct GNUNET_MQ_Envelope *env)
Transmit message msg via connection cc.
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.
void(* GCC_ReadyCallback)(void *cls, int is_ready)
Function called to notify tunnel about change in our readiness.
void GCC_debug(struct CadetConnection *cc, enum GNUNET_ErrorType level)
Log connection info.
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.
const struct GNUNET_CADET_ConnectionTunnelIdentifier * GCC_get_id(struct CadetConnection *cc)
Obtain unique ID for the connection.
Information we track per peer.
GNUNET_ErrorType
Types of errors.
Purpose for the signature of a monotime.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose is GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR.
struct GNUNET_TIME_AbsoluteNBO monotonic_time
Time at the initiator when generating the signature.
Performance metrics for a connection.
struct GNUNET_TIME_Relative aged_latency
Our current best estimate of the latency, based on a weighted average of at least latency_datapoints ...
unsigned long long num_acked_transmissions
How many packets that ought to generate an ACK did we send via this connection?
struct GNUNET_TIME_Absolute age
When was this connection first established? (by us sending or receiving the CREATE_ACK for the first ...
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)
Low-level connection to a destination.
struct CadetTConnection * ct
Which tunnel is using this connection?
GCC_ReadyCallback ready_cb
Function to call once we are ready to transmit.
struct GNUNET_CADET_ConnectionTunnelIdentifier cid
ID of the connection.
void * ready_cb_cls
Closure for ready_cb.
struct CadetPeerPath * path
Path we are using to our destination.
unsigned int off
Offset of our destination in path.
struct CadetPeer * destination
To which peer does this connection go?
Information regarding a possible path to reach a peer.
Peer description.
Entry in list of connections used by tunnel, with metadata.
struct CadetConnection * cc
Connection handle.
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 of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.