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 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 
35 
37 {
40 
43 
46 };
47 
57 
63 void
65 
74 int
76 
84 int
86 
93 void
95 
102 int
103 is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
104 
115 void
117  struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
118 
129 void
130 send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message,
131  struct GNUNET_HashCode *hash);
132 
140 void
141 forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message,
142  const struct GNUNET_HashCode *hash);
143 
152 const struct GNUNET_HashCode*
154 
155 #endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H
GNUnet MESSENGER service.
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.
A 256-bit hashcode.
cryptographic primitives for GNUnet
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 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
void send_tunnel_envelope(struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MQ_Envelope *env, struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Sends an envelope containing a message with a given hash through a tunnel by a given handle...
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.
struct GNUNET_ShortHashCode * contact_id
void send_tunnel_message(struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash)
Sends a message by packing it automatically into an envelope and passing it through the tunnel...
int bind_tunnel(struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel)
Binds a CADET channel to a tunnel on returns GNUNET_YES only if the bounds channel was replaced succe...