aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_mesh_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_mesh_service.h')
-rw-r--r--src/include/gnunet_mesh_service.h182
1 files changed, 112 insertions, 70 deletions
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h
index 25744248b..7e332c749 100644
--- a/src/include/gnunet_mesh_service.h
+++ b/src/include/gnunet_mesh_service.h
@@ -68,12 +68,13 @@ struct GNUNET_MESH_Tunnel;
68 * GNUNET_SYSERR to close it (signal serious error) 68 * GNUNET_SYSERR to close it (signal serious error)
69 */ 69 */
70typedef int 70typedef int
71 (*GNUNET_MESH_MessageCallback) (void *cls, 71 (*GNUNET_MESH_MessageCallback) (void *cls,
72 struct GNUNET_MESH_Tunnel *tunnel, 72 struct GNUNET_MESH_Tunnel * tunnel,
73 void **tunnel_ctx, 73 void **tunnel_ctx,
74 const struct GNUNET_PeerIdentity *sender, 74 const struct GNUNET_PeerIdentity * sender,
75 const struct GNUNET_MessageHeader *message, 75 const struct GNUNET_MessageHeader * message,
76 const struct GNUNET_TRANSPORT_ATS_Information *atsi); 76 const struct
77 GNUNET_TRANSPORT_ATS_Information * atsi);
77 78
78 79
79/** 80/**
@@ -110,9 +111,9 @@ struct GNUNET_MESH_MessageHandler
110 * @param tunnel connection to the other end (henceforth invalid) 111 * @param tunnel connection to the other end (henceforth invalid)
111 * @param tunnel_ctx place where local state associated with the tunnel is stored 112 * @param tunnel_ctx place where local state associated with the tunnel is stored
112 */ 113 */
113typedef void (GNUNET_MESH_TunnelEndHandler)(void *cls, 114typedef void (GNUNET_MESH_TunnelEndHandler) (void *cls,
114 const struct GNUNET_MESH_Tunnel *tunnel, 115 const struct GNUNET_MESH_Tunnel *
115 void **tunnel_ctx); 116 tunnel, void **tunnel_ctx);
116 117
117 118
118/** 119/**
@@ -135,12 +136,17 @@ typedef uint32_t GNUNET_MESH_ApplicationType;
135 * @return handle to the mesh service 136 * @return handle to the mesh service
136 * NULL on error (in this case, init is never called) 137 * NULL on error (in this case, init is never called)
137 */ 138 */
138struct GNUNET_MESH_Handle * 139struct GNUNET_MESH_Handle *GNUNET_MESH_connect (const struct
139GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 140 GNUNET_CONFIGURATION_Handle
140 void *cls, 141 *cfg, void *cls,
141 GNUNET_MESH_TunnelEndHandler cleaner, 142 GNUNET_MESH_TunnelEndHandler
142 const struct GNUNET_MESH_MessageHandler *handlers, 143 cleaner,
143 const GNUNET_MESH_ApplicationType *stypes); 144 const struct
145 GNUNET_MESH_MessageHandler
146 *handlers,
147 const
148 GNUNET_MESH_ApplicationType
149 *stypes);
144 150
145/** 151/**
146 * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise 152 * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise
@@ -148,8 +154,9 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
148 * @param tunnel the tunnel 154 * @param tunnel the tunnel
149 * @return the peer or NULL 155 * @return the peer or NULL
150 */ 156 */
151const struct GNUNET_PeerIdentity* 157const struct GNUNET_PeerIdentity *GNUNET_MESH_get_peer (const struct
152GNUNET_MESH_get_peer(const struct GNUNET_MESH_Tunnel* tunnel); 158 GNUNET_MESH_Tunnel
159 *tunnel);
153 160
154 161
155/** 162/**
@@ -170,7 +177,9 @@ void GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle);
170 * @param peer peer identity the tunnel stopped working with 177 * @param peer peer identity the tunnel stopped working with
171 */ 178 */
172typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls, 179typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls,
173 const struct GNUNET_PeerIdentity *peer); 180 const struct
181 GNUNET_PeerIdentity *
182 peer);
174 183
175 184
176/** 185/**
@@ -181,8 +190,11 @@ typedef void (*GNUNET_MESH_TunnelDisconnectHandler) (void *cls,
181 * @param atsi performance data for the connection 190 * @param atsi performance data for the connection
182 */ 191 */
183typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls, 192typedef void (*GNUNET_MESH_TunnelConnectHandler) (void *cls,
184 const struct GNUNET_PeerIdentity *peer, 193 const struct
185 const struct GNUNET_TRANSPORT_ATS_Information *atsi); 194 GNUNET_PeerIdentity * peer,
195 const struct
196 GNUNET_TRANSPORT_ATS_Information
197 * atsi);
186 198
187 199
188 200
@@ -206,14 +218,23 @@ struct GNUNET_MESH_PeerRequestHandle;
206 * @param handler_cls closure for handler 218 * @param handler_cls closure for handler
207 * @return NULL on error (handler will not be called), otherwise handle for cancellation 219 * @return NULL on error (handler will not be called), otherwise handle for cancellation
208 */ 220 */
209struct GNUNET_MESH_Tunnel * 221struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_any (struct
210GNUNET_MESH_peer_request_connect_any (struct GNUNET_MESH_Handle *h, 222 GNUNET_MESH_Handle
211 struct GNUNET_TIME_Relative timeout, 223 *h,
212 unsigned int num_peers, 224 struct
213 const struct GNUNET_PeerIdentity *peers, 225 GNUNET_TIME_Relative
214 GNUNET_MESH_TunnelConnectHandler connect_handler, 226 timeout,
215 GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, 227 unsigned int
216 void *handler_cls); 228 num_peers,
229 const struct
230 GNUNET_PeerIdentity
231 *peers,
232 GNUNET_MESH_TunnelConnectHandler
233 connect_handler,
234 GNUNET_MESH_TunnelDisconnectHandler
235 disconnect_handler,
236 void
237 *handler_cls);
217 238
218 239
219/** 240/**
@@ -233,14 +254,23 @@ GNUNET_MESH_peer_request_connect_any (struct GNUNET_MESH_Handle *h,
233 * @param handler_cls closure for handler 254 * @param handler_cls closure for handler
234 * @return NULL on error (handler will not be called), otherwise handle for cancellation 255 * @return NULL on error (handler will not be called), otherwise handle for cancellation
235 */ 256 */
236struct GNUNET_MESH_Tunnel * 257struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_all (struct
237GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *h, 258 GNUNET_MESH_Handle
238 struct GNUNET_TIME_Relative timeout, 259 *h,
239 unsigned int num_peers, 260 struct
240 const struct GNUNET_PeerIdentity *peers, 261 GNUNET_TIME_Relative
241 GNUNET_MESH_TunnelConnectHandler connect_handler, 262 timeout,
242 GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, 263 unsigned int
243 void *handler_cls); 264 num_peers,
265 const struct
266 GNUNET_PeerIdentity
267 *peers,
268 GNUNET_MESH_TunnelConnectHandler
269 connect_handler,
270 GNUNET_MESH_TunnelDisconnectHandler
271 disconnect_handler,
272 void
273 *handler_cls);
244 274
245 275
246/** 276/**
@@ -253,8 +283,8 @@ GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *h,
253 */ 283 */
254void 284void
255GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, 285GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel,
256 struct GNUNET_TIME_Relative timeout, 286 struct GNUNET_TIME_Relative timeout,
257 const struct GNUNET_PeerIdentity *peer); 287 const struct GNUNET_PeerIdentity *peer);
258 288
259 289
260/** 290/**
@@ -266,7 +296,7 @@ GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel,
266 */ 296 */
267void 297void
268GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, 298GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel,
269 const struct GNUNET_PeerIdentity *peer); 299 const struct GNUNET_PeerIdentity *peer);
270 300
271 301
272/** 302/**
@@ -286,13 +316,20 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel,
286 * @param handler_cls closure for handler 316 * @param handler_cls closure for handler
287 * @return NULL on error (handler will not be called), otherwise handle for cancellation 317 * @return NULL on error (handler will not be called), otherwise handle for cancellation
288 */ 318 */
289struct GNUNET_MESH_Tunnel * 319struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_by_type (struct
290GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h, 320 GNUNET_MESH_Handle
291 struct GNUNET_TIME_Relative timeout, 321 *h,
292 GNUNET_MESH_ApplicationType app_type, 322 struct
293 GNUNET_MESH_TunnelConnectHandler connect_handler, 323 GNUNET_TIME_Relative
294 GNUNET_MESH_TunnelDisconnectHandler disconnect_handler, 324 timeout,
295 void *handler_cls); 325 GNUNET_MESH_ApplicationType
326 app_type,
327 GNUNET_MESH_TunnelConnectHandler
328 connect_handler,
329 GNUNET_MESH_TunnelDisconnectHandler
330 disconnect_handler,
331 void
332 *handler_cls);
296 333
297 334
298/** 335/**
@@ -301,8 +338,7 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h,
301 * 338 *
302 * @param req request handle that was returned for the original request 339 * @param req request handle that was returned for the original request
303 */ 340 */
304void 341void GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req);
305GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req);
306 342
307 343
308/** 344/**
@@ -332,22 +368,25 @@ struct GNUNET_MESH_TransmitHandle;
332 * NULL if we can not even queue the request (insufficient 368 * NULL if we can not even queue the request (insufficient
333 * memory); if NULL is returned, "notify" will NOT be called. 369 * memory); if NULL is returned, "notify" will NOT be called.
334 */ 370 */
335struct GNUNET_MESH_TransmitHandle * 371struct GNUNET_MESH_TransmitHandle *GNUNET_MESH_notify_transmit_ready (struct
336GNUNET_MESH_notify_transmit_ready (struct 372 GNUNET_MESH_Tunnel
337 GNUNET_MESH_Tunnel 373 *tunnel,
338 *tunnel, 374 int cork,
339 int cork, 375 uint32_t
340 uint32_t priority, 376 priority,
341 struct 377 struct
342 GNUNET_TIME_Relative 378 GNUNET_TIME_Relative
343 maxdelay, 379 maxdelay,
344 const struct GNUNET_PeerIdentity *target, 380 const
345 size_t 381 struct
346 notify_size, 382 GNUNET_PeerIdentity
347 GNUNET_CONNECTION_TransmitReadyNotify 383 *target,
348 notify, 384 size_t
349 void 385 notify_size,
350 *notify_cls); 386 GNUNET_CONNECTION_TransmitReadyNotify
387 notify,
388 void
389 *notify_cls);
351 390
352 391
353/** 392/**
@@ -359,13 +398,16 @@ void
359GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle 398GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
360 *th); 399 *th);
361 400
362void GNUNET_MESH_tunnel_set_head(struct GNUNET_MESH_Tunnel* tunnel, void* head); 401void GNUNET_MESH_tunnel_set_head (struct GNUNET_MESH_Tunnel *tunnel,
363void GNUNET_MESH_tunnel_set_tail(struct GNUNET_MESH_Tunnel* tunnel, void* tail); 402 void *head);
364void* GNUNET_MESH_tunnel_get_head(struct GNUNET_MESH_Tunnel* tunnel); 403void GNUNET_MESH_tunnel_set_tail (struct GNUNET_MESH_Tunnel *tunnel,
365void* GNUNET_MESH_tunnel_get_tail(struct GNUNET_MESH_Tunnel* tunnel); 404 void *tail);
405void *GNUNET_MESH_tunnel_get_head (struct GNUNET_MESH_Tunnel *tunnel);
406void *GNUNET_MESH_tunnel_get_tail (struct GNUNET_MESH_Tunnel *tunnel);
366 407
367void GNUNET_MESH_tunnel_set_data(struct GNUNET_MESH_Tunnel* tunnel, void* data); 408void GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel,
368void* GNUNET_MESH_tunnel_get_data(struct GNUNET_MESH_Tunnel* tunnel); 409 void *data);
410void *GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel);
369 411
370#if 0 /* keep Emacsens' auto-indent happy */ 412#if 0 /* keep Emacsens' auto-indent happy */
371{ 413{