aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_server_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_server_lib.h')
-rw-r--r--src/include/gnunet_server_lib.h214
1 files changed, 110 insertions, 104 deletions
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h
index d9663ac82..3d8130c60 100644
--- a/src/include/gnunet_server_lib.h
+++ b/src/include/gnunet_server_lib.h
@@ -122,12 +122,12 @@ struct GNUNET_SERVER_MessageHandler
122 * @return handle for the new server, NULL on error 122 * @return handle for the new server, NULL on error
123 * (typically, "port" already in use) 123 * (typically, "port" already in use)
124 */ 124 */
125struct GNUNET_SERVER_Handle 125struct GNUNET_SERVER_Handle *
126 *GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access, 126GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access,
127 void *access_cls, 127 void *access_cls,
128 struct GNUNET_NETWORK_Handle **lsocks, 128 struct GNUNET_NETWORK_Handle **lsocks,
129 struct GNUNET_TIME_Relative 129 struct GNUNET_TIME_Relative idle_timeout,
130 idle_timeout, int require_found); 130 int require_found);
131 131
132/** 132/**
133 * Create a new server. 133 * Create a new server.
@@ -142,14 +142,12 @@ struct GNUNET_SERVER_Handle
142 * @return handle for the new server, NULL on error 142 * @return handle for the new server, NULL on error
143 * (typically, "port" already in use) 143 * (typically, "port" already in use)
144 */ 144 */
145struct GNUNET_SERVER_Handle *GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck 145struct GNUNET_SERVER_Handle *
146 access, void *access_cls, 146GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cls,
147 struct sockaddr *const 147 struct sockaddr *const *serverAddr,
148 *serverAddr, 148 const socklen_t * socklen,
149 const socklen_t * socklen, 149 struct GNUNET_TIME_Relative idle_timeout,
150 struct GNUNET_TIME_Relative 150 int require_found);
151 idle_timeout,
152 int require_found);
153 151
154 152
155/** 153/**
@@ -157,7 +155,8 @@ struct GNUNET_SERVER_Handle *GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck
157 * 155 *
158 * @param s server to destroy 156 * @param s server to destroy
159 */ 157 */
160void GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s); 158void
159GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s);
161 160
162 161
163/** 162/**
@@ -173,9 +172,10 @@ void GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s);
173 * the handlers array must exist until removed 172 * the handlers array must exist until removed
174 * (or server is destroyed). 173 * (or server is destroyed).
175 */ 174 */
176void GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server, 175void
177 const struct GNUNET_SERVER_MessageHandler 176GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server,
178 *handlers); 177 const struct GNUNET_SERVER_MessageHandler
178 *handlers);
179 179
180 180
181/** 181/**
@@ -193,12 +193,12 @@ void GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server,
193 * GNUNET_CONNECTION_notify_transmit_ready_cancel. 193 * GNUNET_CONNECTION_notify_transmit_ready_cancel.
194 * NULL if we are already going to notify someone else (busy) 194 * NULL if we are already going to notify someone else (busy)
195 */ 195 */
196struct GNUNET_CONNECTION_TransmitHandle 196struct GNUNET_CONNECTION_TransmitHandle *
197 *GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, 197GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
198 size_t size, 198 size_t size,
199 struct GNUNET_TIME_Relative timeout, 199 struct GNUNET_TIME_Relative timeout,
200 GNUNET_CONNECTION_TransmitReadyNotify 200 GNUNET_CONNECTION_TransmitReadyNotify
201 callback, void *callback_cls); 201 callback, void *callback_cls);
202 202
203 203
204/** 204/**
@@ -207,7 +207,8 @@ struct GNUNET_CONNECTION_TransmitHandle
207 * 207 *
208 * @param client the client to set the persistent flag on 208 * @param client the client to set the persistent flag on
209 */ 209 */
210void GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); 210void
211GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client);
211 212
212/** 213/**
213 * Resume receiving from this client, we are done processing the 214 * Resume receiving from this client, we are done processing the
@@ -221,8 +222,8 @@ void GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client);
221 * GNUNET_SYSERR to close the connection (signal 222 * GNUNET_SYSERR to close the connection (signal
222 * serious error) 223 * serious error)
223 */ 224 */
224void GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, 225void
225 int success); 226GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success);
226 227
227 228
228/** 229/**
@@ -233,8 +234,9 @@ void GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client,
233 * @param client the client to update 234 * @param client the client to update
234 * @param timeout new timeout for activities on the socket 235 * @param timeout new timeout for activities on the socket
235 */ 236 */
236void GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, 237void
237 struct GNUNET_TIME_Relative timeout); 238GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client,
239 struct GNUNET_TIME_Relative timeout);
238 240
239 241
240/** 242/**
@@ -244,8 +246,9 @@ void GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client,
244 * 246 *
245 * @param client client for which to disable the warning 247 * @param client client for which to disable the warning
246 */ 248 */
247void GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client 249void
248 *client); 250GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client
251 *client);
249 252
250 253
251/** 254/**
@@ -263,9 +266,10 @@ void GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client
263 * GNUNET_SYSERR if the connection to the 266 * GNUNET_SYSERR if the connection to the
264 * client should be shut down 267 * client should be shut down
265 */ 268 */
266int GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, 269int
267 struct GNUNET_SERVER_Client *sender, 270GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
268 const struct GNUNET_MessageHeader *message); 271 struct GNUNET_SERVER_Client *sender,
272 const struct GNUNET_MessageHeader *message);
269 273
270 274
271/** 275/**
@@ -280,12 +284,9 @@ int GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
280 * @return the client handle (client should call 284 * @return the client handle (client should call
281 * "client_drop" on the return value eventually) 285 * "client_drop" on the return value eventually)
282 */ 286 */
283struct GNUNET_SERVER_Client *GNUNET_SERVER_connect_socket (struct 287struct GNUNET_SERVER_Client *
284 GNUNET_SERVER_Handle 288GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
285 *server, 289 struct GNUNET_CONNECTION_Handle *connection);
286 struct
287 GNUNET_CONNECTION_Handle
288 *connection);
289 290
290 291
291/** 292/**
@@ -295,7 +296,8 @@ struct GNUNET_SERVER_Client *GNUNET_SERVER_connect_socket (struct
295 * 296 *
296 * @param client the client to keep 297 * @param client the client to keep
297 */ 298 */
298void GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client); 299void
300GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client);
299 301
300 302
301/** 303/**
@@ -306,7 +308,8 @@ void GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client);
306 * 308 *
307 * @param client the client to drop 309 * @param client the client to drop
308 */ 310 */
309void GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client); 311void
312GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client);
310 313
311 314
312/** 315/**
@@ -317,8 +320,9 @@ void GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client);
317 * @param addrlen where to store the length of the address 320 * @param addrlen where to store the length of the address
318 * @return GNUNET_OK on success 321 * @return GNUNET_OK on success
319 */ 322 */
320int GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client, 323int
321 void **addr, size_t * addrlen); 324GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client,
325 void **addr, size_t * addrlen);
322 326
323 327
324/** 328/**
@@ -348,9 +352,10 @@ typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls,
348 * @param callback function to call on disconnect 352 * @param callback function to call on disconnect
349 * @param callback_cls closure for callback 353 * @param callback_cls closure for callback
350 */ 354 */
351void GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, 355void
352 GNUNET_SERVER_DisconnectCallback callback, 356GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
353 void *callback_cls); 357 GNUNET_SERVER_DisconnectCallback callback,
358 void *callback_cls);
354 359
355 360
356/** 361/**
@@ -360,10 +365,10 @@ void GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
360 * @param callback function to call on disconnect 365 * @param callback function to call on disconnect
361 * @param callback_cls closure for callback 366 * @param callback_cls closure for callback
362 */ 367 */
363void GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle 368void
364 *server, 369GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server,
365 GNUNET_SERVER_DisconnectCallback 370 GNUNET_SERVER_DisconnectCallback
366 callback, void *callback_cls); 371 callback, void *callback_cls);
367 372
368 373
369/** 374/**
@@ -374,7 +379,8 @@ void GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle
374 * 379 *
375 * @param client the client to disconnect from 380 * @param client the client to disconnect from
376 */ 381 */
377void GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); 382void
383GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client);
378 384
379 385
380/** 386/**
@@ -388,8 +394,8 @@ void GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client);
388 * @param h server handle 394 * @param h server handle
389 * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default 395 * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default
390 */ 396 */
391void GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, 397void
392 int do_ignore); 398GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, int do_ignore);
393 399
394 400
395 401
@@ -401,7 +407,8 @@ void GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h,
401 * @param client handle to the client 407 * @param client handle to the client
402 * @return GNUNET_OK on success 408 * @return GNUNET_OK on success
403 */ 409 */
404int GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client); 410int
411GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client);
405 412
406 413
407/** 414/**
@@ -419,9 +426,8 @@ struct GNUNET_SERVER_TransmitContext;
419 * @param client client to create the context for. 426 * @param client client to create the context for.
420 * @return NULL on error 427 * @return NULL on error
421 */ 428 */
422struct GNUNET_SERVER_TransmitContext 429struct GNUNET_SERVER_TransmitContext *
423 *GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client 430GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client *client);
424 *client);
425 431
426 432
427/** 433/**
@@ -434,10 +440,10 @@ struct GNUNET_SERVER_TransmitContext
434 * @param length length of data 440 * @param length length of data
435 * @param type type of the message 441 * @param type type of the message
436 */ 442 */
437void GNUNET_SERVER_transmit_context_append_data (struct 443void
438 GNUNET_SERVER_TransmitContext 444GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext
439 *tc, const void *data, 445 *tc, const void *data,
440 size_t length, uint16_t type); 446 size_t length, uint16_t type);
441 447
442 448
443/** 449/**
@@ -448,11 +454,12 @@ void GNUNET_SERVER_transmit_context_append_data (struct
448 * @param tc context to use 454 * @param tc context to use
449 * @param msg message to append 455 * @param msg message to append
450 */ 456 */
451void GNUNET_SERVER_transmit_context_append_message (struct 457void
452 GNUNET_SERVER_TransmitContext 458GNUNET_SERVER_transmit_context_append_message (struct
453 *tc, 459 GNUNET_SERVER_TransmitContext
454 const struct 460 *tc,
455 GNUNET_MessageHeader *msg); 461 const struct GNUNET_MessageHeader
462 *msg);
456 463
457 464
458/** 465/**
@@ -464,9 +471,9 @@ void GNUNET_SERVER_transmit_context_append_message (struct
464 * @param tc transmission context to use 471 * @param tc transmission context to use
465 * @param timeout when to time out and abort the transmission 472 * @param timeout when to time out and abort the transmission
466 */ 473 */
467void GNUNET_SERVER_transmit_context_run (struct GNUNET_SERVER_TransmitContext 474void
468 *tc, 475GNUNET_SERVER_transmit_context_run (struct GNUNET_SERVER_TransmitContext *tc,
469 struct GNUNET_TIME_Relative timeout); 476 struct GNUNET_TIME_Relative timeout);
470 477
471 478
472 479
@@ -490,10 +497,9 @@ struct GNUNET_SERVER_NotificationContext;
490 * if the queue gets longer than this number of messages 497 * if the queue gets longer than this number of messages
491 * @return handle to the notification context 498 * @return handle to the notification context
492 */ 499 */
493struct GNUNET_SERVER_NotificationContext 500struct GNUNET_SERVER_NotificationContext *
494 *GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle 501GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle *server,
495 *server, 502 unsigned int queue_length);
496 unsigned int queue_length);
497 503
498 504
499/** 505/**
@@ -501,9 +507,10 @@ struct GNUNET_SERVER_NotificationContext
501 * 507 *
502 * @param nc context to destroy. 508 * @param nc context to destroy.
503 */ 509 */
504void GNUNET_SERVER_notification_context_destroy (struct 510void
505 GNUNET_SERVER_NotificationContext 511GNUNET_SERVER_notification_context_destroy (struct
506 *nc); 512 GNUNET_SERVER_NotificationContext
513 *nc);
507 514
508 515
509/** 516/**
@@ -512,11 +519,10 @@ void GNUNET_SERVER_notification_context_destroy (struct
512 * @param nc context to modify 519 * @param nc context to modify
513 * @param client client to add 520 * @param client client to add
514 */ 521 */
515void GNUNET_SERVER_notification_context_add (struct 522void
516 GNUNET_SERVER_NotificationContext 523GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext
517 *nc, 524 *nc,
518 struct GNUNET_SERVER_Client 525 struct GNUNET_SERVER_Client *client);
519 *client);
520 526
521 527
522/** 528/**
@@ -528,14 +534,13 @@ void GNUNET_SERVER_notification_context_add (struct
528 * @param msg message to send 534 * @param msg message to send
529 * @param can_drop can this message be dropped due to queue length limitations 535 * @param can_drop can this message be dropped due to queue length limitations
530 */ 536 */
531void GNUNET_SERVER_notification_context_unicast (struct 537void
532 GNUNET_SERVER_NotificationContext 538GNUNET_SERVER_notification_context_unicast (struct
533 *nc, 539 GNUNET_SERVER_NotificationContext
534 struct GNUNET_SERVER_Client 540 *nc,
535 *client, 541 struct GNUNET_SERVER_Client *client,
536 const struct 542 const struct GNUNET_MessageHeader
537 GNUNET_MessageHeader *msg, 543 *msg, int can_drop);
538 int can_drop);
539 544
540 545
541/** 546/**
@@ -545,12 +550,12 @@ void GNUNET_SERVER_notification_context_unicast (struct
545 * @param msg message to send 550 * @param msg message to send
546 * @param can_drop can this message be dropped due to queue length limitations 551 * @param can_drop can this message be dropped due to queue length limitations
547 */ 552 */
548void GNUNET_SERVER_notification_context_broadcast (struct 553void
549 GNUNET_SERVER_NotificationContext 554GNUNET_SERVER_notification_context_broadcast (struct
550 *nc, 555 GNUNET_SERVER_NotificationContext
551 const struct 556 *nc,
552 GNUNET_MessageHeader *msg, 557 const struct GNUNET_MessageHeader
553 int can_drop); 558 *msg, int can_drop);
554 559
555 560
556 561
@@ -580,9 +585,9 @@ typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *client,
580 * @param cb_cls closure for cb 585 * @param cb_cls closure for cb
581 * @return handle to tokenizer 586 * @return handle to tokenizer
582 */ 587 */
583struct GNUNET_SERVER_MessageStreamTokenizer 588struct GNUNET_SERVER_MessageStreamTokenizer *
584 *GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, 589GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb,
585 void *cb_cls); 590 void *cb_cls);
586 591
587 592
588/** 593/**
@@ -601,9 +606,10 @@ struct GNUNET_SERVER_MessageStreamTokenizer
601 * GNUNET_NO if one_shot was set and we have another message ready 606 * GNUNET_NO if one_shot was set and we have another message ready
602 * GNUNET_SYSERR if the data stream is corrupt 607 * GNUNET_SYSERR if the data stream is corrupt
603 */ 608 */
604int GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, 609int
605 void *client_identity, const char *buf, 610GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
606 size_t size, int purge, int one_shot); 611 void *client_identity, const char *buf, size_t size,
612 int purge, int one_shot);
607 613
608 614
609/** 615/**
@@ -611,8 +617,8 @@ int GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
611 * 617 *
612 * @param mst tokenizer to destroy 618 * @param mst tokenizer to destroy
613 */ 619 */
614void GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer 620void
615 *mst); 621GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst);
616 622
617 623
618#if 0 /* keep Emacsens' auto-indent happy */ 624#if 0 /* keep Emacsens' auto-indent happy */