diff options
Diffstat (limited to 'src/include/gnunet_server_lib.h')
-rw-r--r-- | src/include/gnunet_server_lib.h | 127 |
1 files changed, 60 insertions, 67 deletions
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index e4b856db0..d9663ac82 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h | |||
@@ -73,8 +73,8 @@ struct GNUNET_SERVER_Client; | |||
73 | typedef void (*GNUNET_SERVER_MessageCallback) (void *cls, | 73 | typedef void (*GNUNET_SERVER_MessageCallback) (void *cls, |
74 | struct GNUNET_SERVER_Client * | 74 | struct GNUNET_SERVER_Client * |
75 | client, | 75 | client, |
76 | const struct | 76 | const struct GNUNET_MessageHeader |
77 | GNUNET_MessageHeader * message); | 77 | * message); |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
@@ -173,10 +173,9 @@ void GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s); | |||
173 | * the handlers array must exist until removed | 173 | * the handlers array must exist until removed |
174 | * (or server is destroyed). | 174 | * (or server is destroyed). |
175 | */ | 175 | */ |
176 | void | 176 | void GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server, |
177 | GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server, | 177 | const struct GNUNET_SERVER_MessageHandler |
178 | const struct GNUNET_SERVER_MessageHandler | 178 | *handlers); |
179 | *handlers); | ||
180 | 179 | ||
181 | 180 | ||
182 | /** | 181 | /** |
@@ -222,8 +221,8 @@ void GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); | |||
222 | * GNUNET_SYSERR to close the connection (signal | 221 | * GNUNET_SYSERR to close the connection (signal |
223 | * serious error) | 222 | * serious error) |
224 | */ | 223 | */ |
225 | void | 224 | void GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, |
226 | GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success); | 225 | int success); |
227 | 226 | ||
228 | 227 | ||
229 | /** | 228 | /** |
@@ -234,9 +233,8 @@ GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client, int success); | |||
234 | * @param client the client to update | 233 | * @param client the client to update |
235 | * @param timeout new timeout for activities on the socket | 234 | * @param timeout new timeout for activities on the socket |
236 | */ | 235 | */ |
237 | void | 236 | void GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, |
238 | GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | 237 | struct GNUNET_TIME_Relative timeout); |
239 | struct GNUNET_TIME_Relative timeout); | ||
240 | 238 | ||
241 | 239 | ||
242 | /** | 240 | /** |
@@ -246,9 +244,8 @@ GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | |||
246 | * | 244 | * |
247 | * @param client client for which to disable the warning | 245 | * @param client client for which to disable the warning |
248 | */ | 246 | */ |
249 | void | 247 | void GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client |
250 | GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | 248 | *client); |
251 | *client); | ||
252 | 249 | ||
253 | 250 | ||
254 | /** | 251 | /** |
@@ -266,10 +263,9 @@ GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | |||
266 | * GNUNET_SYSERR if the connection to the | 263 | * GNUNET_SYSERR if the connection to the |
267 | * client should be shut down | 264 | * client should be shut down |
268 | */ | 265 | */ |
269 | int | 266 | int GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, |
270 | GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, | 267 | struct GNUNET_SERVER_Client *sender, |
271 | struct GNUNET_SERVER_Client *sender, | 268 | const struct GNUNET_MessageHeader *message); |
272 | const struct GNUNET_MessageHeader *message); | ||
273 | 269 | ||
274 | 270 | ||
275 | /** | 271 | /** |
@@ -334,8 +330,8 @@ int GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client, | |||
334 | * for the last call when the server is destroyed | 330 | * for the last call when the server is destroyed |
335 | */ | 331 | */ |
336 | typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls, | 332 | typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls, |
337 | struct GNUNET_SERVER_Client | 333 | struct GNUNET_SERVER_Client * |
338 | * client); | 334 | client); |
339 | 335 | ||
340 | 336 | ||
341 | /** | 337 | /** |
@@ -353,8 +349,8 @@ typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls, | |||
353 | * @param callback_cls closure for callback | 349 | * @param callback_cls closure for callback |
354 | */ | 350 | */ |
355 | void GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, | 351 | void GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server, |
356 | GNUNET_SERVER_DisconnectCallback | 352 | GNUNET_SERVER_DisconnectCallback callback, |
357 | callback, void *callback_cls); | 353 | void *callback_cls); |
358 | 354 | ||
359 | 355 | ||
360 | /** | 356 | /** |
@@ -392,8 +388,8 @@ void GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); | |||
392 | * @param h server handle | 388 | * @param h server handle |
393 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default | 389 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default |
394 | */ | 390 | */ |
395 | void | 391 | void GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, |
396 | GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, int do_ignore); | 392 | int do_ignore); |
397 | 393 | ||
398 | 394 | ||
399 | 395 | ||
@@ -438,10 +434,10 @@ struct GNUNET_SERVER_TransmitContext | |||
438 | * @param length length of data | 434 | * @param length length of data |
439 | * @param type type of the message | 435 | * @param type type of the message |
440 | */ | 436 | */ |
441 | void | 437 | void GNUNET_SERVER_transmit_context_append_data (struct |
442 | GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext | 438 | GNUNET_SERVER_TransmitContext |
443 | *tc, const void *data, | 439 | *tc, const void *data, |
444 | size_t length, uint16_t type); | 440 | size_t length, uint16_t type); |
445 | 441 | ||
446 | 442 | ||
447 | /** | 443 | /** |
@@ -452,12 +448,11 @@ GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext | |||
452 | * @param tc context to use | 448 | * @param tc context to use |
453 | * @param msg message to append | 449 | * @param msg message to append |
454 | */ | 450 | */ |
455 | void | 451 | void GNUNET_SERVER_transmit_context_append_message (struct |
456 | GNUNET_SERVER_transmit_context_append_message (struct | 452 | GNUNET_SERVER_TransmitContext |
457 | GNUNET_SERVER_TransmitContext | 453 | *tc, |
458 | *tc, | 454 | const struct |
459 | const struct GNUNET_MessageHeader | 455 | GNUNET_MessageHeader *msg); |
460 | *msg); | ||
461 | 456 | ||
462 | 457 | ||
463 | /** | 458 | /** |
@@ -469,9 +464,9 @@ GNUNET_SERVER_transmit_context_append_message (struct | |||
469 | * @param tc transmission context to use | 464 | * @param tc transmission context to use |
470 | * @param timeout when to time out and abort the transmission | 465 | * @param timeout when to time out and abort the transmission |
471 | */ | 466 | */ |
472 | void | 467 | void GNUNET_SERVER_transmit_context_run (struct GNUNET_SERVER_TransmitContext |
473 | GNUNET_SERVER_transmit_context_run (struct GNUNET_SERVER_TransmitContext *tc, | 468 | *tc, |
474 | struct GNUNET_TIME_Relative timeout); | 469 | struct GNUNET_TIME_Relative timeout); |
475 | 470 | ||
476 | 471 | ||
477 | 472 | ||
@@ -506,10 +501,9 @@ struct GNUNET_SERVER_NotificationContext | |||
506 | * | 501 | * |
507 | * @param nc context to destroy. | 502 | * @param nc context to destroy. |
508 | */ | 503 | */ |
509 | void | 504 | void GNUNET_SERVER_notification_context_destroy (struct |
510 | GNUNET_SERVER_notification_context_destroy (struct | 505 | GNUNET_SERVER_NotificationContext |
511 | GNUNET_SERVER_NotificationContext | 506 | *nc); |
512 | *nc); | ||
513 | 507 | ||
514 | 508 | ||
515 | /** | 509 | /** |
@@ -518,10 +512,11 @@ GNUNET_SERVER_notification_context_destroy (struct | |||
518 | * @param nc context to modify | 512 | * @param nc context to modify |
519 | * @param client client to add | 513 | * @param client client to add |
520 | */ | 514 | */ |
521 | void | 515 | void GNUNET_SERVER_notification_context_add (struct |
522 | GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | 516 | GNUNET_SERVER_NotificationContext |
523 | *nc, | 517 | *nc, |
524 | struct GNUNET_SERVER_Client *client); | 518 | struct GNUNET_SERVER_Client |
519 | *client); | ||
525 | 520 | ||
526 | 521 | ||
527 | /** | 522 | /** |
@@ -533,13 +528,14 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | |||
533 | * @param msg message to send | 528 | * @param msg message to send |
534 | * @param can_drop can this message be dropped due to queue length limitations | 529 | * @param can_drop can this message be dropped due to queue length limitations |
535 | */ | 530 | */ |
536 | void | 531 | void GNUNET_SERVER_notification_context_unicast (struct |
537 | GNUNET_SERVER_notification_context_unicast (struct | 532 | GNUNET_SERVER_NotificationContext |
538 | GNUNET_SERVER_NotificationContext | 533 | *nc, |
539 | *nc, | 534 | struct GNUNET_SERVER_Client |
540 | struct GNUNET_SERVER_Client *client, | 535 | *client, |
541 | const struct GNUNET_MessageHeader | 536 | const struct |
542 | *msg, int can_drop); | 537 | GNUNET_MessageHeader *msg, |
538 | int can_drop); | ||
543 | 539 | ||
544 | 540 | ||
545 | /** | 541 | /** |
@@ -549,12 +545,12 @@ GNUNET_SERVER_notification_context_unicast (struct | |||
549 | * @param msg message to send | 545 | * @param msg message to send |
550 | * @param can_drop can this message be dropped due to queue length limitations | 546 | * @param can_drop can this message be dropped due to queue length limitations |
551 | */ | 547 | */ |
552 | void | 548 | void GNUNET_SERVER_notification_context_broadcast (struct |
553 | GNUNET_SERVER_notification_context_broadcast (struct | 549 | GNUNET_SERVER_NotificationContext |
554 | GNUNET_SERVER_NotificationContext | 550 | *nc, |
555 | *nc, | 551 | const struct |
556 | const struct GNUNET_MessageHeader | 552 | GNUNET_MessageHeader *msg, |
557 | *msg, int can_drop); | 553 | int can_drop); |
558 | 554 | ||
559 | 555 | ||
560 | 556 | ||
@@ -571,8 +567,7 @@ struct GNUNET_SERVER_MessageStreamTokenizer; | |||
571 | * @param client identification of the client | 567 | * @param client identification of the client |
572 | * @param message the actual message | 568 | * @param message the actual message |
573 | */ | 569 | */ |
574 | typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, | 570 | typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *client, |
575 | void *client, | ||
576 | const struct | 571 | const struct |
577 | GNUNET_MessageHeader * | 572 | GNUNET_MessageHeader * |
578 | message); | 573 | message); |
@@ -606,11 +601,9 @@ struct GNUNET_SERVER_MessageStreamTokenizer | |||
606 | * GNUNET_NO if one_shot was set and we have another message ready | 601 | * GNUNET_NO if one_shot was set and we have another message ready |
607 | * GNUNET_SYSERR if the data stream is corrupt | 602 | * GNUNET_SYSERR if the data stream is corrupt |
608 | */ | 603 | */ |
609 | int | 604 | int GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, |
610 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | 605 | void *client_identity, const char *buf, |
611 | void *client_identity, | 606 | size_t size, int purge, int one_shot); |
612 | const char *buf, | ||
613 | size_t size, int purge, int one_shot); | ||
614 | 607 | ||
615 | 608 | ||
616 | /** | 609 | /** |
@@ -618,8 +611,8 @@ GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | |||
618 | * | 611 | * |
619 | * @param mst tokenizer to destroy | 612 | * @param mst tokenizer to destroy |
620 | */ | 613 | */ |
621 | void | 614 | void GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer |
622 | GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst); | 615 | *mst); |
623 | 616 | ||
624 | 617 | ||
625 | #if 0 /* keep Emacsens' auto-indent happy */ | 618 | #if 0 /* keep Emacsens' auto-indent happy */ |