aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-10-10 15:47:00 +0000
committerChristian Grothoff <christian@grothoff.org>2016-10-10 15:47:00 +0000
commit93085e8a2991fde229400b588a5930e9fcca0d75 (patch)
tree0384246adbd96fa0138a46ad5fecb777aa40e789 /src/testbed/gnunet-service-testbed.h
parent2bf962c76bb82c1f38acea42c7bdfb241e2582e7 (diff)
downloadgnunet-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.h234
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
178struct Peer 177struct 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
298struct 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 */
396struct HandlerContext_ShutdownPeers 403struct 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 */
515void
516GST_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 */
532void 528void
533GST_destroy_peers (); 529GST_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 */
555void 550void
556GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, 551handle_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 */
599void 594void
600GST_clear_fopcq (); 595GST_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 */
610void 605void
611GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client, 606GST_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 */
616void
617GST_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 */
625void
626GST_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 */
621void 635void
622GST_send_operation_success_msg (struct GNUNET_SERVER_Client *client, 636GST_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 */
647int
648check_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 */
633void 658void
634GST_handle_remote_overlay_connect (void *cls, 659handle_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 */
670int
671check_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 */
646void 681void
647GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client, 682handle_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 */
658void 692void
659GST_handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client, 693handle_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 */
670void 703void
671GST_handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client, 704handle_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 */
682void 714void
683GST_handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client, 715handle_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 */
694void 725void
695GST_handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client, 726handle_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 */
706void 736void
707GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client, 737handle_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 */
748int
749check_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 */
718void 759void
719GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client, 760handle_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 */
773int
774check_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 */
732void 786void
733GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client, 787handle_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 */
740void 794void
741GST_free_mctxq (); 795GST_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 */
747void 801void
748GST_free_lcfq (); 802GST_free_lcf (void);
749 803
750 804
751/** 805/**
752 * Cleans up the route list 806 * Cleans up the route list
753 */ 807 */
754void 808void
755GST_route_list_clear (); 809GST_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 */
779void 833void
780GST_free_occq (); 834GST_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 */
786void 840void
787GST_free_roccq (); 841GST_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 */
793void 847void
794GST_free_prcq (); 848GST_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 */
809void 863void
810GST_cache_clear (); 864GST_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 */
847void 901void
848GST_stats_destroy (); 902GST_stats_destroy (void);
849 903
850/* End of gnunet-service-testbed.h */ 904/* End of gnunet-service-testbed.h */