GNUnet  0.11.x
gnunet-service-messenger_tunnel.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2020--2021 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  */
26 #ifndef GNUNET_SERVICE_MESSENGER_TUNNEL_H
27 #define GNUNET_SERVICE_MESSENGER_TUNNEL_H
28 
29 #include "platform.h"
30 #include "gnunet_cadet_service.h"
31 #include "gnunet_peer_lib.h"
32 #include "gnunet_crypto_lib.h"
33 
36 
38 {
41 
43 
45 
48 };
49 
59 
65 void
67 
75 void
77 
85 int
87 
94 void
96 
103 int
104 is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
105 
114 void
116  const struct GNUNET_HashCode *hash);
117 
128 int
129 send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message);
130 
138 void
139 forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message,
140  const struct GNUNET_HashCode *hash);
141 
150 const struct GNUNET_HashCode*
152 
160 void
162 
172 uint32_t
174 
183 int
184 update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version);
185 
186 #endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H
GNUnet MESSENGER service.
void send_tunnel_envelope(struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, const struct GNUNET_HashCode *hash)
Sends an envelope containing a message with a given hash through a tunnel.
Opaque handle to a channel.
Definition: cadet.h:116
void disconnect_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Disconnects and unbinds a channel from a tunnel.
void destroy_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Destroys a tunnel and frees its memory fully.
void forward_tunnel_message(struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Forwards a given message with a known hash through a tunnel.
cryptographic primitives for GNUnet
uint32_t get_tunnel_messenger_version(const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Returns the current messenger version the peer connected via a given tunnel has reported to be using ...
unsigned int GNUNET_PEER_Id
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used ins...
struct GNUNET_MESSENGER_SrvRoom * room
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
const struct GNUNET_HashCode * get_tunnel_peer_message(const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Returns the hash of the latest peer message published through a given tunnel and matching the tunnels...
A 512-bit hashcode.
int update_tunnel_messenger_version(struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version)
Updates the messenger version of the tunnel to a given version if it is compatible to the running pee...
int is_tunnel_connected(const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Returns the status of a currently bound channel of a tunnel.
int connect_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Tries to connect a tunnel by creating a new CADET channel and binding it.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_CADET_Channel * channel
struct GNUNET_MESSENGER_MessageState state
The identity of the host (wraps the signing key of the peer).
struct GNUNET_MESSENGER_SrvTunnel * create_tunnel(struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door)
Creates and allocates a tunnel of a room to a specific peer identity (called door).
int send_tunnel_message(struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message)
Sends a message by packing it automatically into an envelope and passing it through the tunnel...
void get_tunnel_peer_identity(const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer)
Writes the peer identity of the peer connected via tunnel to this peer into the peer parameter...
void bind_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel)
Binds a CADET channel to a tunnel and replaces its channel the tunnel is currently bound to if necess...