aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_connection.h
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2016-09-20 01:21:59 +0000
committerBart Polot <bart@net.in.tum.de>2016-09-20 01:21:59 +0000
commitb4d5f474eef10017a470dccb01dae86c32bd5ddb (patch)
tree4b97bb46f4ab15c732e284ef0b275cc0dbc3173a /src/cadet/gnunet-service-cadet_connection.h
parent506899aa2be2b4d5dc09c1740969c28ddf43c82d (diff)
downloadgnunet-b4d5f474eef10017a470dccb01dae86c32bd5ddb.tar.gz
gnunet-b4d5f474eef10017a470dccb01dae86c32bd5ddb.zip
Port CADET to CORE MQ API
Diffstat (limited to 'src/cadet/gnunet-service-cadet_connection.h')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.h146
1 files changed, 58 insertions, 88 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h
index e96e2f24c..6302cd898 100644
--- a/src/cadet/gnunet-service-cadet_connection.h
+++ b/src/cadet/gnunet-service-cadet_connection.h
@@ -118,90 +118,86 @@ typedef void
118 118
119 119
120/** 120/**
121 * Core handler for connection creation. 121 * Handler for connection creation.
122 * 122 *
123 * @param cls Closure (unused). 123 * @param peer Message sender (neighbor).
124 * @param peer Sender (neighbor). 124 * @param msg Message itself.
125 * @param message Message.
126 * @return #GNUNET_OK to keep the connection open,
127 * #GNUNET_SYSERR to close it (signal serious error)
128 */ 125 */
129int 126void
130GCC_handle_create (void *cls, 127GCC_handle_create (struct CadetPeer *peer,
131 const struct GNUNET_PeerIdentity *peer, 128 const struct GNUNET_CADET_ConnectionCreate *msg);
132 const struct GNUNET_MessageHeader *message);
133 129
134 130
135/** 131/**
136 * Core handler for path confirmations. 132 * Handler for connection confirmations.
137 * 133 *
138 * @param cls closure 134 * @param peer Message sender (neighbor).
139 * @param message message 135 * @param msg Message itself.
140 * @param peer peer identity this notification is about
141 * @return #GNUNET_OK to keep the connection open,
142 * #GNUNET_SYSERR to close it (signal serious error)
143 */ 136 */
144int 137void
145GCC_handle_confirm (void *cls, 138GCC_handle_confirm (struct CadetPeer *peer,
146 const struct GNUNET_PeerIdentity *peer, 139 const struct GNUNET_CADET_ConnectionACK *msg);
147 const struct GNUNET_MessageHeader *message);
148 140
149 141
150/** 142/**
151 * Core handler for notifications of broken paths 143 * Handler for notifications of broken connections.
152 * 144 *
153 * @param cls Closure (unused). 145 * @param peer Message sender (neighbor).
154 * @param id Peer identity of sending neighbor. 146 * @param msg Message itself.
155 * @param message Message.
156 * @return #GNUNET_OK to keep the connection open,
157 * #GNUNET_SYSERR to close it (signal serious error)
158 */ 147 */
159int 148void
160GCC_handle_broken (void* cls, 149GCC_handle_broken (struct CadetPeer *peer,
161 const struct GNUNET_PeerIdentity* id, 150 const struct GNUNET_CADET_ConnectionBroken *msg);
162 const struct GNUNET_MessageHeader* message);
163 151
164/** 152/**
165 * Core handler for tunnel destruction 153 * Handler for notifications of destroyed connections.
166 * 154 *
167 * @param cls Closure (unused). 155 * @param peer Message sender (neighbor).
168 * @param peer Peer identity of sending neighbor. 156 * @param msg Message itself.
169 * @param message Message.
170 *
171 * @return GNUNET_OK to keep the connection open,
172 * GNUNET_SYSERR to close it (signal serious error)
173 */ 157 */
174int 158void
175GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, 159GCC_handle_destroy (struct CadetPeer *peer,
176 const struct GNUNET_MessageHeader *message); 160 const struct GNUNET_CADET_ConnectionDestroy *msg);
177 161
178/** 162/**
179 * Core handler for key exchange traffic (ephemeral key, ping, pong). 163 * Handler for cadet network traffic hop-by-hop acks.
180 * 164 *
181 * @param cls Closure (unused). 165 * @param peer Message sender (neighbor).
182 * @param message Message received. 166 * @param msg Message itself.
183 * @param peer Peer who sent the message. 167 */
168void
169GCC_handle_ack (struct CadetPeer *peer,
170 const struct GNUNET_CADET_ACK *msg);
171
172/**
173 * Handler for cadet network traffic hop-by-hop data counter polls.
184 * 174 *
185 * @return GNUNET_OK to keep the connection open, 175 * @param peer Message sender (neighbor).
186 * GNUNET_SYSERR to close it (signal serious error) 176 * @param msg Message itself.
187 */ 177 */
188int 178void
189GCC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, 179GCC_handle_poll (struct CadetPeer *peer,
190 const struct GNUNET_MessageHeader *message); 180 const struct GNUNET_CADET_Poll *msg);
191 181
192/** 182/**
193 * Core handler for encrypted cadet network traffic (channel mgmt, data). 183 * Handler for key exchange traffic (Axolotl KX).
194 * 184 *
195 * @param cls Closure (unused). 185 * @param peer Message sender (neighbor).
196 * @param message Message received. 186 * @param msg Message itself.
197 * @param peer Peer who sent the message. 187 */
188void
189GCC_handle_kx (struct CadetPeer *peer,
190 const struct GNUNET_CADET_KX *msg);
191
192/**
193 * Handler for encrypted cadet network traffic (channel mgmt, data).
198 * 194 *
199 * @return GNUNET_OK to keep the connection open, 195 * @param peer Message sender (neighbor).
200 * GNUNET_SYSERR to close it (signal serious error) 196 * @param msg Message itself.
201 */ 197 */
202int 198void
203GCC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, 199GCC_handle_encrypted (struct CadetPeer *peer,
204 const struct GNUNET_MessageHeader *message); 200 const struct GNUNET_CADET_AX *msg);
205 201
206/** 202/**
207 * Core handler for axolotl key exchange traffic. 203 * Core handler for axolotl key exchange traffic.
@@ -230,34 +226,6 @@ GCC_handle_ax (void *cls, const struct GNUNET_PeerIdentity *peer,
230 struct GNUNET_MessageHeader *message); 226 struct GNUNET_MessageHeader *message);
231 227
232/** 228/**
233 * Core handler for cadet network traffic point-to-point acks.
234 *
235 * @param cls closure
236 * @param message message
237 * @param peer peer identity this notification is about
238 *
239 * @return GNUNET_OK to keep the connection open,
240 * GNUNET_SYSERR to close it (signal serious error)
241 */
242int
243GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
244 const struct GNUNET_MessageHeader *message);
245
246/**
247 * Core handler for cadet network traffic point-to-point ack polls.
248 *
249 * @param cls closure
250 * @param message message
251 * @param peer peer identity this notification is about
252 *
253 * @return GNUNET_OK to keep the connection open,
254 * GNUNET_SYSERR to close it (signal serious error)
255 */
256int
257GCC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
258 const struct GNUNET_MessageHeader *message);
259
260/**
261 * Core handler for cadet keepalives. 229 * Core handler for cadet keepalives.
262 * 230 *
263 * @param cls closure 231 * @param cls closure
@@ -301,11 +269,12 @@ GCC_shutdown (void);
301 * Create a connection. 269 * Create a connection.
302 * 270 *
303 * @param cid Connection ID (either created locally or imposed remotely). 271 * @param cid Connection ID (either created locally or imposed remotely).
304 * @param t Tunnel this connection belongs to (or NULL); 272 * @param t Tunnel this connection belongs to (or NULL for transit connections);
305 * @param path Path this connection has to use (copy is made). 273 * @param path Path this connection has to use (copy is made).
306 * @param own_pos Own position in the @c path path. 274 * @param own_pos Own position in the @c path path.
307 * 275 *
308 * @return Newly created connection, NULL in case of error (own id not in path). 276 * @return Newly created connection.
277 * NULL in case of error: own id not in path, wrong neighbors, ...
309 */ 278 */
310struct CadetConnection * 279struct CadetConnection *
311GCC_new (const struct GNUNET_CADET_Hash *cid, 280GCC_new (const struct GNUNET_CADET_Hash *cid,
@@ -525,6 +494,7 @@ GCC_cancel (struct CadetConnectionQueue *q);
525 * @param message Message to send. Function makes a copy of it. 494 * @param message Message to send. Function makes a copy of it.
526 * If message is not hop-by-hop, decrements TTL of copy. 495 * If message is not hop-by-hop, decrements TTL of copy.
527 * @param payload_type Type of payload, in case the message is encrypted. 496 * @param payload_type Type of payload, in case the message is encrypted.
497 * @param payload_id ID of the payload (PID, ACK, ...).
528 * @param c Connection on which this message is transmitted. 498 * @param c Connection on which this message is transmitted.
529 * @param fwd Is this a fwd message? 499 * @param fwd Is this a fwd message?
530 * @param force Force the connection to accept the message (buffer overfill). 500 * @param force Force the connection to accept the message (buffer overfill).