2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file mesh/gnunet-service-mesh_channel.h
23 * @brief mesh service; dealing with end-to-end channels
24 * @author Bartlomiej Polot
26 * All functions in this file should use the prefix GMCH (Gnunet Mesh CHannel)
29 #ifndef GNUNET_SERVICE_MESH_CHANNEL_H
30 #define GNUNET_SERVICE_MESH_CHANNEL_H
35 #if 0 /* keep Emacsens' auto-indent happy */
41 #include "gnunet_util_lib.h"
44 * Struct containing all information regarding a channel to a remote client.
49 #include "gnunet-service-mesh_tunnel.h"
60 GMCH_get_id (const struct MeshChannel *ch);
63 * Get the channel tunnel.
65 * @param ch Channel to get the tunnel from.
67 * @return tunnel of the channel.
70 GMCH_get_tunnel (const struct MeshChannel *ch);
73 * Get free buffer space towards the client on a specific channel.
76 * @param fwd Is query about FWD traffic?
78 * @return Free buffer space [0 - 64]
81 GMCH_get_buffer (struct MeshChannel *ch, int fwd);
84 * Is the root client for this channel on this peer?
87 * @param fwd Is this for fwd traffic?
89 * @return GNUNET_YES in case it is.
92 GMCH_is_origin (struct MeshChannel *ch, int fwd);
95 * Is the destination client for this channel on this peer?
98 * @param fwd Is this for fwd traffic?
100 * @return GNUNET_YES in case it is.
103 GMCH_is_terminal (struct MeshChannel *ch, int fwd);
106 * Send an end-to-end ACK message for the most recent in-sequence payload.
108 * If channel is not reliable, do nothing.
110 * @param ch Channel this is about.
111 * @param fwd Is for FWD traffic? (ACK dest->owner)
114 GMCH_send_ack (struct MeshChannel *ch, int fwd);
117 * Send data on a channel.
119 * If the destination is local, send it to client, otherwise encrypt and
123 * @param msg Message.
124 * @param fwd Is this a fwd (root->dest) message?
127 GMCH_send_data (struct MeshChannel *ch,
128 const struct GNUNET_MESH_Data *msg,
132 * Notify the destination client that a new incoming channel was created.
134 * @param ch Channel that was created.
137 GMCH_send_create (struct MeshChannel *ch);
141 * Notify a client that the channel is no longer valid.
143 * @param ch Channel that is destroyed.
144 * @param fwd Forward notification (owner->dest)?
147 GMCH_send_destroy (struct MeshChannel *ch, int fwd);
156 GMCH_debug (struct MeshChannel *ch);
160 * Handler for mesh network payload traffic.
162 * @param ch Channel for the message.
163 * @param message Unencryted data message.
164 * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
167 GMCH_handle_data (struct MeshChannel *ch,
168 const struct GNUNET_MESH_Data *msg,
173 * Handler for mesh network traffic end-to-end ACKs.
175 * @param t Tunnel on which we got this message.
176 * @param message Data message.
177 * @param fwd Is this a fwd ACK? (dest->orig)
180 GMCH_handle_data_ack (struct MeshChannel *ch,
181 const struct GNUNET_MESH_DataACK *msg,
186 * Handler for channel create messages.
188 * @param t Tunnel this channel is to be created in.
189 * @param msg Message.
190 * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
193 GMCH_handle_create (const struct GNUNET_MESH_ChannelCreate *msg,
198 * Handler for channel ack messages.
200 * @param t Tunnel this channel is to be created in.
201 * @param msg Message.
202 * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
205 GMCH_handle_ack (struct MeshChannel *ch,
206 const struct GNUNET_MESH_ChannelManage *msg,
211 * Handler for channel destroy messages.
213 * @param t Tunnel this channel is to be destroyed of.
214 * @param msg Message.
215 * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
218 GMCH_handle_destroy (struct MeshChannel *ch,
219 const struct GNUNET_MESH_ChannelManage *msg,
225 * Sends an already built message on a channel, properly registering
226 * all used resources and encrypting the message with the tunnel's key.
228 * @param message Message to send. Function makes a copy of it.
229 * @param ch Channel on which this message is transmitted.
230 * @param fwd Is this a fwd message?
233 GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
234 struct MeshChannel *ch, int fwd);
237 #if 0 /* keep Emacsens' auto-indent happy */
244 /* ifndef GNUNET_SERVICE_MESH_CHANNEL_H */
246 /* end of gnunet-service-mesh_channel.h */