GNUnet 0.22.2
gnunet-service-messenger_tunnel.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2024 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
30#include "gnunet_util_lib.h"
31
34
36{
39
41
43
46};
47
57 const struct GNUNET_PeerIdentity *door);
58
64void
66
74void
77
86check_tunnel_message (void *cls,
87 const struct GNUNET_MessageHeader *header);
88
96void
97handle_tunnel_message (void *cls,
98 const struct GNUNET_MessageHeader *header);
99
107void
109 const struct GNUNET_CADET_Channel *channel);
110
120
127void
129
138
147void
149 struct GNUNET_MQ_Envelope *env,
150 const struct GNUNET_HashCode *hash);
151
164 void *handle,
165 struct GNUNET_MESSENGER_Message *message);
166
174void
176 const struct GNUNET_MESSENGER_Message *message,
177 const struct GNUNET_HashCode *hash);
178
187const struct GNUNET_HashCode*
189
197void
199 struct GNUNET_PeerIdentity *peer);
200
210uint32_t
212
224 uint32_t version);
225
226#endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
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.
enum GNUNET_GenericReturnValue 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...
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.
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...
enum GNUNET_GenericReturnValue is_tunnel_connected(const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Returns the status of a currently bound channel of a tunnel.
void handle_tunnel_message(void *cls, const struct GNUNET_MessageHeader *header)
Callback for message handling via header in a tunnel that is provided as a closure from a CADET chann...
void destroy_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Destroys a tunnel and frees its memory fully.
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...
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 ...
enum GNUNET_GenericReturnValue check_tunnel_message(void *cls, const struct GNUNET_MessageHeader *header)
Callback for message verification via header in a tunnel that is provided as a closure from a CADET c...
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 callback_tunnel_disconnect(void *cls, const struct GNUNET_CADET_Channel *channel)
Callback for a CADET channel disconnecting to manage this event as a proper tunnel provided as its cl...
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).
void disconnect_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Disconnects and unbinds a channel from a tunnel.
enum GNUNET_GenericReturnValue connect_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel)
Tries to connect a tunnel by creating a new CADET channel and binding it.
enum GNUNET_GenericReturnValue 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.
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
CADET service; establish channels to distant peers.
GNUNET_GenericReturnValue
Named constants for return values.
unsigned int GNUNET_PEER_Id
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used ins...
Opaque handle to a channel.
Definition: cadet.h:116
A 512-bit hashcode.
struct GNUNET_CADET_Channel * channel
struct GNUNET_MESSENGER_MessageState state
struct GNUNET_MESSENGER_SrvRoom * room
Header for all communications.
The identity of the host (wraps the signing key of the peer).