diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-13 21:59:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-13 21:59:41 +0000 |
commit | 06d594e14f81143df0197ce468bd82967471bcb4 (patch) | |
tree | 9143722ac52023ad7db9237d2475f9bd7ba02d73 /src/transport/gnunet-service-transport_clients.c | |
parent | c01972f2300865e9750092d566da5b08a05c7b4f (diff) | |
download | gnunet-06d594e14f81143df0197ce468bd82967471bcb4.tar.gz gnunet-06d594e14f81143df0197ce468bd82967471bcb4.zip |
setup handlers
Diffstat (limited to 'src/transport/gnunet-service-transport_clients.c')
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 113 |
1 files changed, 62 insertions, 51 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 64592d5d6..f03c3a4d3 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -326,29 +326,6 @@ client_disconnect_notification (void *cls, | |||
326 | 326 | ||
327 | 327 | ||
328 | /** | 328 | /** |
329 | * Start handling requests from clients. | ||
330 | * | ||
331 | * @param server server used to accept clients from. | ||
332 | */ | ||
333 | void | ||
334 | GST_clients_start (struct GNUNET_SERVER_Handle *server) | ||
335 | { | ||
336 | GNUNET_SERVER_disconnect_notify (server, | ||
337 | &client_disconnect_notification, NULL); | ||
338 | } | ||
339 | |||
340 | |||
341 | /** | ||
342 | * Stop processing clients. | ||
343 | */ | ||
344 | void | ||
345 | GST_clients_stop () | ||
346 | { | ||
347 | /* nothing to do */ | ||
348 | } | ||
349 | |||
350 | |||
351 | /** | ||
352 | * Function called for each of our connected neighbours. Notify the | 329 | * Function called for each of our connected neighbours. Notify the |
353 | * client about the existing neighbour. | 330 | * client about the existing neighbour. |
354 | * | 331 | * |
@@ -391,10 +368,10 @@ notify_client_about_neighbour (void *cls, | |||
391 | * @param client the client | 368 | * @param client the client |
392 | * @param message the start message that was sent | 369 | * @param message the start message that was sent |
393 | */ | 370 | */ |
394 | void | 371 | static void |
395 | GST_clients_handle_start (void *cls, | 372 | clients_handle_start (void *cls, |
396 | struct GNUNET_SERVER_Client *client, | 373 | struct GNUNET_SERVER_Client *client, |
397 | const struct GNUNET_MessageHeader *message) | 374 | const struct GNUNET_MessageHeader *message) |
398 | { | 375 | { |
399 | const struct StartMessage *start; | 376 | const struct StartMessage *start; |
400 | struct TransportClient *tc; | 377 | struct TransportClient *tc; |
@@ -434,10 +411,10 @@ GST_clients_handle_start (void *cls, | |||
434 | * @param client the client | 411 | * @param client the client |
435 | * @param message the HELLO message | 412 | * @param message the HELLO message |
436 | */ | 413 | */ |
437 | void | 414 | static void |
438 | GST_clients_handle_hello (void *cls, | 415 | clients_handle_hello (void *cls, |
439 | struct GNUNET_SERVER_Client *client, | 416 | struct GNUNET_SERVER_Client *client, |
440 | const struct GNUNET_MessageHeader *message) | 417 | const struct GNUNET_MessageHeader *message) |
441 | { | 418 | { |
442 | GST_validation_handle_hello (message); | 419 | GST_validation_handle_hello (message); |
443 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 420 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -493,10 +470,10 @@ handle_send_transmit_continuation (void *cls, | |||
493 | * @param client the client | 470 | * @param client the client |
494 | * @param message the send message that was sent | 471 | * @param message the send message that was sent |
495 | */ | 472 | */ |
496 | void | 473 | static void |
497 | GST_clients_handle_send (void *cls, | 474 | clients_handle_send (void *cls, |
498 | struct GNUNET_SERVER_Client *client, | 475 | struct GNUNET_SERVER_Client *client, |
499 | const struct GNUNET_MessageHeader *message) | 476 | const struct GNUNET_MessageHeader *message) |
500 | { | 477 | { |
501 | const struct OutboundMessage *obm; | 478 | const struct OutboundMessage *obm; |
502 | const struct GNUNET_MessageHeader *obmm; | 479 | const struct GNUNET_MessageHeader *obmm; |
@@ -563,10 +540,10 @@ GST_clients_handle_send (void *cls, | |||
563 | * @param client the client | 540 | * @param client the client |
564 | * @param message the quota changing message | 541 | * @param message the quota changing message |
565 | */ | 542 | */ |
566 | void | 543 | static void |
567 | GST_clients_handle_set_quota (void *cls, | 544 | clients_handle_set_quota (void *cls, |
568 | struct GNUNET_SERVER_Client *client, | 545 | struct GNUNET_SERVER_Client *client, |
569 | const struct GNUNET_MessageHeader *message) | 546 | const struct GNUNET_MessageHeader *message) |
570 | { | 547 | { |
571 | const struct QuotaSetMessage *qsm; | 548 | const struct QuotaSetMessage *qsm; |
572 | 549 | ||
@@ -622,10 +599,10 @@ transmit_address_to_client (void *cls, | |||
622 | * @param client the client | 599 | * @param client the client |
623 | * @param message the resolution request | 600 | * @param message the resolution request |
624 | */ | 601 | */ |
625 | void | 602 | static void |
626 | GST_clients_handle_address_lookup (void *cls, | 603 | clients_handle_address_lookup (void *cls, |
627 | struct GNUNET_SERVER_Client *client, | 604 | struct GNUNET_SERVER_Client *client, |
628 | const struct GNUNET_MessageHeader *message) | 605 | const struct GNUNET_MessageHeader *message) |
629 | { | 606 | { |
630 | const struct AddressLookupMessage *alum; | 607 | const struct AddressLookupMessage *alum; |
631 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 608 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
@@ -734,10 +711,10 @@ send_address_to_client (void *cls, | |||
734 | * @param client the client | 711 | * @param client the client |
735 | * @param message the peer address information request | 712 | * @param message the peer address information request |
736 | */ | 713 | */ |
737 | void | 714 | static void |
738 | GST_clients_handle_peer_address_lookup (void *cls, | 715 | clients_handle_peer_address_lookup (void *cls, |
739 | struct GNUNET_SERVER_Client *client, | 716 | struct GNUNET_SERVER_Client *client, |
740 | const struct GNUNET_MessageHeader *message) | 717 | const struct GNUNET_MessageHeader *message) |
741 | { | 718 | { |
742 | const struct PeerAddressLookupMessage *peer_address_lookup; | 719 | const struct PeerAddressLookupMessage *peer_address_lookup; |
743 | struct GNUNET_SERVER_TransmitContext *tc; | 720 | struct GNUNET_SERVER_TransmitContext *tc; |
@@ -791,10 +768,10 @@ output_addresses (void *cls, | |||
791 | * @param client the client | 768 | * @param client the client |
792 | * @param message the peer address information request | 769 | * @param message the peer address information request |
793 | */ | 770 | */ |
794 | void | 771 | static void |
795 | GST_clients_handle_address_iterate (void *cls, | 772 | clients_handle_address_iterate (void *cls, |
796 | struct GNUNET_SERVER_Client *client, | 773 | struct GNUNET_SERVER_Client *client, |
797 | const struct GNUNET_MessageHeader *message) | 774 | const struct GNUNET_MessageHeader *message) |
798 | { | 775 | { |
799 | struct GNUNET_SERVER_TransmitContext *tc; | 776 | struct GNUNET_SERVER_TransmitContext *tc; |
800 | 777 | ||
@@ -809,6 +786,40 @@ GST_clients_handle_address_iterate (void *cls, | |||
809 | 786 | ||
810 | 787 | ||
811 | /** | 788 | /** |
789 | * Start handling requests from clients. | ||
790 | * | ||
791 | * @param server server used to accept clients from. | ||
792 | */ | ||
793 | void | ||
794 | GST_clients_start (struct GNUNET_SERVER_Handle *server) | ||
795 | { | ||
796 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | ||
797 | { &clients_handle_start, NULL, sizeof (struct StartMessage)}, | ||
798 | { &clients_handle_hello, NULL, 0}, | ||
799 | { &clients_handle_send, NULL, 0}, | ||
800 | { &clients_handle_set_quota, NULL, sizeof (struct QuotaSetMessage)}, | ||
801 | { &clients_handle_address_lookup, NULL, 0}, | ||
802 | { &clients_handle_peer_address_lookup, NULL, sizeof (struct PeerAddressLookupMessage)}, | ||
803 | { &clients_handle_address_iterate, NULL, sizeof (struct GNUNET_MessageHeader)}, | ||
804 | {NULL, NULL, 0, 0} | ||
805 | }; | ||
806 | GNUNET_SERVER_add_handlers (server, handlers); | ||
807 | GNUNET_SERVER_disconnect_notify (server, | ||
808 | &client_disconnect_notification, NULL); | ||
809 | } | ||
810 | |||
811 | |||
812 | /** | ||
813 | * Stop processing clients. | ||
814 | */ | ||
815 | void | ||
816 | GST_clients_stop () | ||
817 | { | ||
818 | /* nothing to do */ | ||
819 | } | ||
820 | |||
821 | |||
822 | /** | ||
812 | * Broadcast the given message to all of our clients. | 823 | * Broadcast the given message to all of our clients. |
813 | * | 824 | * |
814 | * @param msg message to broadcast | 825 | * @param msg message to broadcast |