diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-10 15:47:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-10 15:47:00 +0000 |
commit | 93085e8a2991fde229400b588a5930e9fcca0d75 (patch) | |
tree | 0384246adbd96fa0138a46ad5fecb777aa40e789 /src/testbed/gnunet-service-testbed.h | |
parent | 2bf962c76bb82c1f38acea42c7bdfb241e2582e7 (diff) | |
download | gnunet-93085e8a2991fde229400b588a5930e9fcca0d75.tar.gz gnunet-93085e8a2991fde229400b588a5930e9fcca0d75.zip |
migrating testbed to new service API
Diffstat (limited to 'src/testbed/gnunet-service-testbed.h')
-rw-r--r-- | src/testbed/gnunet-service-testbed.h | 234 |
1 files changed, 144 insertions, 90 deletions
diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h index b19d3c516..6f797a066 100644 --- a/src/testbed/gnunet-service-testbed.h +++ b/src/testbed/gnunet-service-testbed.h | |||
@@ -96,7 +96,7 @@ struct ForwardedOperationContext | |||
96 | /** | 96 | /** |
97 | * The client to which we have to reply | 97 | * The client to which we have to reply |
98 | */ | 98 | */ |
99 | struct GNUNET_SERVER_Client *client; | 99 | struct GNUNET_SERVICE_Client *client; |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Closure pointer | 102 | * Closure pointer |
@@ -161,7 +161,7 @@ struct LinkControllersContext | |||
161 | /** | 161 | /** |
162 | * The client which initiated the link controller operation | 162 | * The client which initiated the link controller operation |
163 | */ | 163 | */ |
164 | struct GNUNET_SERVER_Client *client; | 164 | struct GNUNET_SERVICE_Client *client; |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * The ID of the operation | 167 | * The ID of the operation |
@@ -174,7 +174,6 @@ struct LinkControllersContext | |||
174 | /** | 174 | /** |
175 | * A peer | 175 | * A peer |
176 | */ | 176 | */ |
177 | |||
178 | struct Peer | 177 | struct Peer |
179 | { | 178 | { |
180 | 179 | ||
@@ -255,7 +254,7 @@ struct Context | |||
255 | /** | 254 | /** |
256 | * The client handle associated with this context | 255 | * The client handle associated with this context |
257 | */ | 256 | */ |
258 | struct GNUNET_SERVER_Client *client; | 257 | struct GNUNET_SERVICE_Client *client; |
259 | 258 | ||
260 | /** | 259 | /** |
261 | * The network address of the master controller | 260 | * The network address of the master controller |
@@ -296,6 +295,9 @@ struct SharedService | |||
296 | }; | 295 | }; |
297 | 296 | ||
298 | 297 | ||
298 | struct RegisteredHostContext; | ||
299 | |||
300 | |||
299 | /** | 301 | /** |
300 | * Context information to used during operations which forward the overlay | 302 | * Context information to used during operations which forward the overlay |
301 | * connect message | 303 | * connect message |
@@ -313,6 +315,11 @@ struct ForwardedOverlayConnectContext | |||
313 | struct ForwardedOverlayConnectContext *prev; | 315 | struct ForwardedOverlayConnectContext *prev; |
314 | 316 | ||
315 | /** | 317 | /** |
318 | * Which host does this FOCC belong to? | ||
319 | */ | ||
320 | struct RegisteredHostContext *rhc; | ||
321 | |||
322 | /** | ||
316 | * A copy of the original overlay connect message | 323 | * A copy of the original overlay connect message |
317 | */ | 324 | */ |
318 | struct GNUNET_MessageHeader *orig_msg; | 325 | struct GNUNET_MessageHeader *orig_msg; |
@@ -320,7 +327,7 @@ struct ForwardedOverlayConnectContext | |||
320 | /** | 327 | /** |
321 | * The client handle | 328 | * The client handle |
322 | */ | 329 | */ |
323 | struct GNUNET_SERVER_Client *client; | 330 | struct GNUNET_SERVICE_Client *client; |
324 | 331 | ||
325 | /** | 332 | /** |
326 | * The id of the operation which created this context information | 333 | * The id of the operation which created this context information |
@@ -391,13 +398,13 @@ struct RegisteredHostContext | |||
391 | 398 | ||
392 | 399 | ||
393 | /** | 400 | /** |
394 | * Context data for GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler | 401 | * Context data for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler |
395 | */ | 402 | */ |
396 | struct HandlerContext_ShutdownPeers | 403 | struct HandlerContext_ShutdownPeers |
397 | { | 404 | { |
398 | /** | 405 | /** |
399 | * The number of slave we expect to hear from since we forwarded the | 406 | * The number of slave we expect to hear from since we forwarded the |
400 | * GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS message to them | 407 | * #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS message to them |
401 | */ | 408 | */ |
402 | unsigned int nslaves; | 409 | unsigned int nslaves; |
403 | 410 | ||
@@ -507,17 +514,6 @@ extern char *GST_stats_dir; | |||
507 | 514 | ||
508 | 515 | ||
509 | /** | 516 | /** |
510 | * Queues a message in send queue for sending to the service | ||
511 | * | ||
512 | * @param client the client to whom the queued message has to be sent | ||
513 | * @param msg the message to queue | ||
514 | */ | ||
515 | void | ||
516 | GST_queue_message (struct GNUNET_SERVER_Client *client, | ||
517 | struct GNUNET_MessageHeader *msg); | ||
518 | |||
519 | |||
520 | /** | ||
521 | * Function to destroy a peer | 517 | * Function to destroy a peer |
522 | * | 518 | * |
523 | * @param peer the peer structure to destroy | 519 | * @param peer the peer structure to destroy |
@@ -530,7 +526,7 @@ GST_destroy_peer (struct Peer *peer); | |||
530 | * Stops and destroys all peers | 526 | * Stops and destroys all peers |
531 | */ | 527 | */ |
532 | void | 528 | void |
533 | GST_destroy_peers (); | 529 | GST_destroy_peers (void); |
534 | 530 | ||
535 | 531 | ||
536 | /** | 532 | /** |
@@ -546,15 +542,14 @@ GST_find_dest_route (uint32_t host_id); | |||
546 | 542 | ||
547 | 543 | ||
548 | /** | 544 | /** |
549 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages | 545 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT messages |
550 | * | 546 | * |
551 | * @param cls NULL | 547 | * @param cls identification of the client |
552 | * @param client identification of the client | 548 | * @param msg the actual message |
553 | * @param message the actual message | ||
554 | */ | 549 | */ |
555 | void | 550 | void |
556 | GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | 551 | handle_overlay_connect (void *cls, |
557 | const struct GNUNET_MessageHeader *message); | 552 | const struct GNUNET_TESTBED_OverlayConnectMessage *msg); |
558 | 553 | ||
559 | 554 | ||
560 | /** | 555 | /** |
@@ -597,7 +592,7 @@ GST_forwarded_operation_timeout (void *cls); | |||
597 | * Clears the forwarded operations queue | 592 | * Clears the forwarded operations queue |
598 | */ | 593 | */ |
599 | void | 594 | void |
600 | GST_clear_fopcq (); | 595 | GST_clear_fopcq (void); |
601 | 596 | ||
602 | 597 | ||
603 | /** | 598 | /** |
@@ -608,8 +603,27 @@ GST_clear_fopcq (); | |||
608 | * @param emsg the error message; can be NULL | 603 | * @param emsg the error message; can be NULL |
609 | */ | 604 | */ |
610 | void | 605 | void |
611 | GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client, | 606 | GST_send_operation_fail_msg (struct GNUNET_SERVICE_Client *client, |
612 | uint64_t operation_id, const char *emsg); | 607 | uint64_t operation_id, |
608 | const char *emsg); | ||
609 | |||
610 | |||
611 | /** | ||
612 | * Notify OC subsystem that @a client disconnected. | ||
613 | * | ||
614 | * @param client the client that disconnected | ||
615 | */ | ||
616 | void | ||
617 | GST_notify_client_disconnect_oc (struct GNUNET_SERVICE_Client *client); | ||
618 | |||
619 | |||
620 | /** | ||
621 | * Notify peers subsystem that @a client disconnected. | ||
622 | * | ||
623 | * @param client the client that disconnected | ||
624 | */ | ||
625 | void | ||
626 | GST_notify_client_disconnect_peers (struct GNUNET_SERVICE_Client *client); | ||
613 | 627 | ||
614 | 628 | ||
615 | /** | 629 | /** |
@@ -619,140 +633,180 @@ GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client, | |||
619 | * @param operation_id the id of the operation which was successful | 633 | * @param operation_id the id of the operation which was successful |
620 | */ | 634 | */ |
621 | void | 635 | void |
622 | GST_send_operation_success_msg (struct GNUNET_SERVER_Client *client, | 636 | GST_send_operation_success_msg (struct GNUNET_SERVICE_Client *client, |
623 | uint64_t operation_id); | 637 | uint64_t operation_id); |
624 | 638 | ||
625 | 639 | ||
626 | /** | 640 | /** |
627 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT messages | 641 | * Check #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages |
628 | * | 642 | * |
629 | * @param cls NULL | 643 | * @param cls identification of the client |
630 | * @param client identification of the client | 644 | * @param msg the actual message |
631 | * @param message the actual message | 645 | * @return #GNUNET_OK if @a msg is well-formed |
646 | */ | ||
647 | int | ||
648 | check_remote_overlay_connect (void *cls, | ||
649 | const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg); | ||
650 | |||
651 | |||
652 | /** | ||
653 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages | ||
654 | * | ||
655 | * @param cls identification of the client | ||
656 | * @param msg the actual message | ||
632 | */ | 657 | */ |
633 | void | 658 | void |
634 | GST_handle_remote_overlay_connect (void *cls, | 659 | handle_remote_overlay_connect (void *cls, |
635 | struct GNUNET_SERVER_Client *client, | 660 | const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg); |
636 | const struct GNUNET_MessageHeader *message); | 661 | |
662 | |||
663 | /** | ||
664 | * Check #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages | ||
665 | * | ||
666 | * @param cls identification of the client | ||
667 | * @param msg the actual message | ||
668 | * @return #GNUNET_OK if @a msg is well-formed | ||
669 | */ | ||
670 | int | ||
671 | check_peer_create (void *cls, | ||
672 | const struct GNUNET_TESTBED_PeerCreateMessage *msg); | ||
637 | 673 | ||
638 | 674 | ||
639 | /** | 675 | /** |
640 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages | 676 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages |
641 | * | 677 | * |
642 | * @param cls NULL | 678 | * @param cls identification of the client |
643 | * @param client identification of the client | ||
644 | * @param message the actual message | 679 | * @param message the actual message |
645 | */ | 680 | */ |
646 | void | 681 | void |
647 | GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client, | 682 | handle_peer_create (void *cls, |
648 | const struct GNUNET_MessageHeader *message); | 683 | const struct GNUNET_TESTBED_PeerCreateMessage *msg); |
649 | 684 | ||
650 | 685 | ||
651 | /** | 686 | /** |
652 | * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages | 687 | * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages |
653 | * | 688 | * |
654 | * @param cls NULL | 689 | * @param cls identification of the client |
655 | * @param client identification of the client | 690 | * @param msg the actual message |
656 | * @param message the actual message | ||
657 | */ | 691 | */ |
658 | void | 692 | void |
659 | GST_handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client, | 693 | handle_peer_destroy (void *cls, |
660 | const struct GNUNET_MessageHeader *message); | 694 | const struct GNUNET_TESTBED_PeerDestroyMessage *msg); |
661 | 695 | ||
662 | 696 | ||
663 | /** | 697 | /** |
664 | * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages | 698 | * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages |
665 | * | 699 | * |
666 | * @param cls NULL | 700 | * @param cls identification of the client |
667 | * @param client identification of the client | 701 | * @param msg the actual message |
668 | * @param message the actual message | ||
669 | */ | 702 | */ |
670 | void | 703 | void |
671 | GST_handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client, | 704 | handle_peer_start (void *cls, |
672 | const struct GNUNET_MessageHeader *message); | 705 | const struct GNUNET_TESTBED_PeerStartMessage *msg); |
673 | 706 | ||
674 | 707 | ||
675 | /** | 708 | /** |
676 | * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages | 709 | * Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages |
677 | * | 710 | * |
678 | * @param cls NULL | 711 | * @param cls identification of the client |
679 | * @param client identification of the client | ||
680 | * @param message the actual message | 712 | * @param message the actual message |
681 | */ | 713 | */ |
682 | void | 714 | void |
683 | GST_handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client, | 715 | handle_peer_stop (void *cls, |
684 | const struct GNUNET_MessageHeader *message); | 716 | const struct GNUNET_TESTBED_PeerStopMessage *msg); |
685 | 717 | ||
686 | 718 | ||
687 | /** | 719 | /** |
688 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG messages | 720 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG messages |
689 | * | 721 | * |
690 | * @param cls NULL | 722 | * @param cls identification of the client |
691 | * @param client identification of the client | 723 | * @param msg the actual message |
692 | * @param message the actual message | ||
693 | */ | 724 | */ |
694 | void | 725 | void |
695 | GST_handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client, | 726 | handle_peer_get_config (void *cls, |
696 | const struct GNUNET_MessageHeader *message); | 727 | const struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg); |
697 | 728 | ||
698 | 729 | ||
699 | /** | 730 | /** |
700 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS messages | 731 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS messages |
701 | * | 732 | * |
702 | * @param cls NULL | 733 | * @param cls identification of the client |
703 | * @param client identification of the client | 734 | * @param msg the actual message |
704 | * @param message the actual message | ||
705 | */ | 735 | */ |
706 | void | 736 | void |
707 | GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client, | 737 | handle_shutdown_peers (void *cls, |
708 | const struct GNUNET_MessageHeader *message); | 738 | const struct GNUNET_TESTBED_ShutdownPeersMessage *msg); |
709 | 739 | ||
710 | 740 | ||
711 | /** | 741 | /** |
712 | * Handler for GNUNET_TESTBED_ManagePeerServiceMessage message | 742 | * Check #GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message |
713 | * | 743 | * |
714 | * @param cls NULL | 744 | * @param cls identification of client |
715 | * @param client identification of client | 745 | * @param msg the actual message |
716 | * @param message the actual message | 746 | * @return #GNUNET_OK if @a msg is well-formed |
747 | */ | ||
748 | int | ||
749 | check_manage_peer_service (void *cls, | ||
750 | const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg); | ||
751 | |||
752 | |||
753 | /** | ||
754 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message | ||
755 | * | ||
756 | * @param cls identification of client | ||
757 | * @param msg the actual message | ||
717 | */ | 758 | */ |
718 | void | 759 | void |
719 | GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client, | 760 | handle_manage_peer_service (void *cls, |
720 | const struct GNUNET_MessageHeader *message); | 761 | const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg); |
762 | |||
763 | |||
721 | 764 | ||
722 | 765 | ||
723 | /** | 766 | /** |
724 | * Handler for GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages. | 767 | * Check #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages. |
768 | * | ||
769 | * @param cls identification of the client | ||
770 | * @param msg the actual message | ||
771 | * @return #GNUNET_OK if @a msg is well-formed | ||
772 | */ | ||
773 | int | ||
774 | check_peer_reconfigure (void *cls, | ||
775 | const struct GNUNET_TESTBED_PeerReconfigureMessage *msg); | ||
776 | |||
777 | |||
778 | /** | ||
779 | * Handler for #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages. | ||
725 | * Should stop the peer asyncronously, destroy it and create it again with the | 780 | * Should stop the peer asyncronously, destroy it and create it again with the |
726 | * new configuration. | 781 | * new configuration. |
727 | * | 782 | * |
728 | * @param cls NULL | 783 | * @param cls identification of the client |
729 | * @param client identification of the client | 784 | * @param msg the actual message |
730 | * @param message the actual message | ||
731 | */ | 785 | */ |
732 | void | 786 | void |
733 | GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client, | 787 | handle_peer_reconfigure (void *cls, |
734 | const struct GNUNET_MessageHeader *message); | 788 | const struct GNUNET_TESTBED_PeerReconfigureMessage *msg); |
735 | 789 | ||
736 | 790 | ||
737 | /** | 791 | /** |
738 | * Frees the ManageServiceContext queue | 792 | * Frees the ManageServiceContext queue |
739 | */ | 793 | */ |
740 | void | 794 | void |
741 | GST_free_mctxq (); | 795 | GST_free_mctxq (void); |
742 | 796 | ||
743 | 797 | ||
744 | /** | 798 | /** |
745 | * Cleans up the queue used for forwarding link controllers requests | 799 | * Cleans up the queue used for forwarding link controllers requests |
746 | */ | 800 | */ |
747 | void | 801 | void |
748 | GST_free_lcfq (); | 802 | GST_free_lcf (void); |
749 | 803 | ||
750 | 804 | ||
751 | /** | 805 | /** |
752 | * Cleans up the route list | 806 | * Cleans up the route list |
753 | */ | 807 | */ |
754 | void | 808 | void |
755 | GST_route_list_clear (); | 809 | GST_route_list_clear (void); |
756 | 810 | ||
757 | 811 | ||
758 | /** | 812 | /** |
@@ -777,21 +831,21 @@ GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc); | |||
777 | * Clears all pending overlay connect contexts in queue | 831 | * Clears all pending overlay connect contexts in queue |
778 | */ | 832 | */ |
779 | void | 833 | void |
780 | GST_free_occq (); | 834 | GST_free_occq (void); |
781 | 835 | ||
782 | 836 | ||
783 | /** | 837 | /** |
784 | * Clears all pending remote overlay connect contexts in queue | 838 | * Clears all pending remote overlay connect contexts in queue |
785 | */ | 839 | */ |
786 | void | 840 | void |
787 | GST_free_roccq (); | 841 | GST_free_roccq (void); |
788 | 842 | ||
789 | 843 | ||
790 | /** | 844 | /** |
791 | * Cleans up the Peer reconfigure context list | 845 | * Cleans up the Peer reconfigure context list |
792 | */ | 846 | */ |
793 | void | 847 | void |
794 | GST_free_prcq (); | 848 | GST_free_prcq (void); |
795 | 849 | ||
796 | 850 | ||
797 | /** | 851 | /** |
@@ -807,7 +861,7 @@ GST_cache_init (unsigned int size); | |||
807 | * Clear cache | 861 | * Clear cache |
808 | */ | 862 | */ |
809 | void | 863 | void |
810 | GST_cache_clear (); | 864 | GST_cache_clear (void); |
811 | 865 | ||
812 | 866 | ||
813 | /** | 867 | /** |
@@ -845,6 +899,6 @@ GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
845 | * Shutdown the status calls module. | 899 | * Shutdown the status calls module. |
846 | */ | 900 | */ |
847 | void | 901 | void |
848 | GST_stats_destroy (); | 902 | GST_stats_destroy (void); |
849 | 903 | ||
850 | /* End of gnunet-service-testbed.h */ | 904 | /* End of gnunet-service-testbed.h */ |