Update plibc header
[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 "gnunet_util_lib.h"
41
42 /**
43  * Struct containing all information regarding a channel to a remote client.
44  */
45 struct MeshChannel;
46
47 /**
48  * Send an end-to-end ACK message for the most recent in-sequence payload.
49  *
50  * If channel is not reliable, do nothing.
51  *
52  * @param ch Channel this is about.
53  * @param fwd Is for FWD traffic? (ACK dest->owner)
54  */
55 void
56 GMCH_send_ack (struct MeshChannel *ch, int fwd);
57
58 /**
59  * Send data on a channel.
60  *
61  * If the destination is local, send it to client, otherwise encrypt and
62  * send to next hop.
63  *
64  * @param ch Channel
65  * @param msg Message.
66  * @param fwd Is this a fwd (root->dest) message?
67  */
68 void
69 GMCH_send_data (struct MeshChannel *ch,
70                 const struct GNUNET_MESH_Data *msg,
71                 int fwd);
72
73 /**
74  * Notify the destination client that a new incoming channel was created.
75  *
76  * @param ch Channel that was created.
77  */
78 void
79 GMCH_send_create (struct MeshChannel *ch);
80
81
82 /**
83  * Notify a client that the channel is no longer valid.
84  *
85  * @param ch Channel that is destroyed.
86  * @param fwd Forward notification (owner->dest)?
87  */
88 void
89 GMCH_send_destroy (struct MeshChannel *ch, int fwd);
90
91
92 /**
93  * Log channel info.
94  *
95  * @param ch Channel.
96  */
97 void
98 GMCH_debug (struct MeshChannel *ch);
99
100
101 /**
102  * Handler for mesh network payload traffic.
103  *
104  * @param t Tunnel on which we got this message.
105  * @param message Unencryted data message.
106  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
107  */
108 void
109 GMCH_handle_data (struct MeshTunnel2 *t,
110                   const struct GNUNET_MESH_Data *msg,
111                   int fwd);
112
113
114 /**
115  * Handler for mesh network traffic end-to-end ACKs.
116  *
117  * @param t Tunnel on which we got this message.
118  * @param message Data message.
119  * @param fwd Is this a fwd ACK? (dest->orig)
120  */
121 void
122 GMCH_handle_data_ack (struct MeshTunnel2 *t,
123                       const struct GNUNET_MESH_DataACK *msg,
124                       int fwd);
125
126
127 /**
128  * Handler for channel create messages.
129  *
130  * @param t Tunnel this channel is to be created in.
131  * @param msg Message.
132  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
133  */
134 void
135 GMCH_handle_create (struct MeshTunnel2 *t,
136                     struct GNUNET_MESH_ChannelCreate *msg,
137                     int fwd);
138
139
140 /**
141  * Handler for channel ack messages.
142  *
143  * @param t Tunnel this channel is to be created in.
144  * @param msg Message.
145  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
146  */
147 void
148 GMCH_handle_ack (struct MeshTunnel2 *t,
149                  struct GNUNET_MESH_ChannelManage *msg,
150                  int fwd);
151
152
153 /**
154  * Handler for channel destroy messages.
155  *
156  * @param t Tunnel this channel is to be destroyed of.
157  * @param msg Message.
158  * @param fwd Is this FWD traffic? GNUNET_YES : GNUNET_NO;
159  */
160 void
161 GMCH_handle_destroy (struct MeshTunnel2 *t,
162                      struct GNUNET_MESH_ChannelManage *msg,
163                      int fwd);
164
165
166
167
168 #if 0                           /* keep Emacsens' auto-indent happy */
169 {
170 #endif
171 #ifdef __cplusplus
172 }
173 #endif
174
175 /* ifndef GNUNET_SERVICE_MESH_CHANNEL_H */
176 #endif
177 /* end of gnunet-service-mesh_channel.h */