-bump name to 97
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_channel.h
1 /*
2      This file is part of GNUnet.
3      (C) 2013 Christian Grothoff (and other contributing authors)
4
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.
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      General Public License for more details.
14
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.
19 */
20
21 /**
22  * @file mesh/gnunet-service-mesh_channel.h
23  * @brief mesh service; dealing with end-to-end channels
24  * @author Bartlomiej Polot
25  *
26  * All functions in this file should use the prefix GMCH (Gnunet Mesh CHannel)
27  */
28
29 #ifndef GNUNET_SERVICE_MESH_CHANNEL_H
30 #define GNUNET_SERVICE_MESH_CHANNEL_H
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0                           /* keep Emacsens' auto-indent happy */
36 }
37 #endif
38 #endif
39
40 #include "platform.h"
41 #include "gnunet_util_lib.h"
42
43 /**
44  * Struct containing all information regarding a channel to a remote client.
45  */
46 struct MeshChannel;
47
48 /**
49  * Count channels in a DLL.
50  * 
51  * @param head Head of the DLL.
52  */
53 unsigned int
54 GMCH_count (const struct MeshChannel *head);
55
56 /**
57  * Send an end-to-end ACK message for the most recent in-sequence payload.
58  *
59  * If channel is not reliable, do nothing.
60  *
61  * @param ch Channel this is about.
62  * @param fwd Is for FWD traffic? (ACK dest->owner)
63  */
64 void
65 GMCH_send_ack (struct MeshChannel *ch, int fwd);
66
67 /**
68  * Send data on a channel.
69  *
70  * If the destination is local, send it to client, otherwise encrypt and
71  * send to next hop.
72  *
73  * @param ch Channel
74  * @param msg Message.
75  * @param fwd Is this a fwd (root->dest) message?
76  */
77 void
78 GMCH_send_data (struct MeshChannel *ch,
79                 const struct GNUNET_MESH_Data *msg,
80                 int fwd);
81
82 /**
83  * Notify the destination client that a new incoming channel was created.
84  *
85  * @param ch Channel that was created.
86  */
87 void
88 GMCH_send_create (struct MeshChannel *ch);
89
90
91 /**
92  * Notify a client that the channel is no longer valid.
93  *
94  * @param ch Channel that is destroyed.
95  * @param fwd Forward notification (owner->dest)?
96  */
97 void
98 GMCH_send_destroy (struct MeshChannel *ch, int fwd);
99
100
101 /**
102  * Log channel info.
103  *
104  * @param ch Channel.
105  */
106 void
107 GMCH_debug (struct MeshChannel *ch);
108
109
110 /**
111  * Handler for mesh network payload traffic.
112  *
113  * @param t Tunnel on which we got this message.
114  * @param message Unencryted data message.
115  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
116  */
117 void
118 GMCH_handle_data (struct MeshTunnel2 *t,
119                   const struct GNUNET_MESH_Data *msg,
120                   int fwd);
121
122
123 /**
124  * Handler for mesh network traffic end-to-end ACKs.
125  *
126  * @param t Tunnel on which we got this message.
127  * @param message Data message.
128  * @param fwd Is this a fwd ACK? (dest->orig)
129  */
130 void
131 GMCH_handle_data_ack (struct MeshTunnel2 *t,
132                       const struct GNUNET_MESH_DataACK *msg,
133                       int fwd);
134
135
136 /**
137  * Handler for channel create messages.
138  *
139  * @param t Tunnel this channel is to be created in.
140  * @param msg Message.
141  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
142  */
143 void
144 GMCH_handle_create (struct MeshTunnel2 *t,
145                     struct GNUNET_MESH_ChannelCreate *msg,
146                     int fwd);
147
148
149 /**
150  * Handler for channel ack messages.
151  *
152  * @param t Tunnel this channel is to be created in.
153  * @param msg Message.
154  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
155  */
156 void
157 GMCH_handle_ack (struct MeshTunnel2 *t,
158                  struct GNUNET_MESH_ChannelManage *msg,
159                  int fwd);
160
161
162 /**
163  * Handler for channel destroy messages.
164  *
165  * @param t Tunnel this channel is to be destroyed of.
166  * @param msg Message.
167  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
168  */
169 void
170 GMCH_handle_destroy (struct MeshTunnel2 *t,
171                      struct GNUNET_MESH_ChannelManage *msg,
172                      int fwd);
173
174
175
176
177 #if 0                           /* keep Emacsens' auto-indent happy */
178 {
179 #endif
180 #ifdef __cplusplus
181 }
182 #endif
183
184 /* ifndef GNUNET_SERVICE_MESH_CHANNEL_H */
185 #endif
186 /* end of gnunet-service-mesh_channel.h */