aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed.h')
-rw-r--r--src/testbed/gnunet-service-testbed.h191
1 files changed, 106 insertions, 85 deletions
diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h
index d68f8a3e4..032dd54ed 100644
--- a/src/testbed/gnunet-service-testbed.h
+++ b/src/testbed/gnunet-service-testbed.h
@@ -42,13 +42,13 @@
42 * Generic logging 42 * Generic logging
43 */ 43 */
44#define LOG(kind, ...) \ 44#define LOG(kind, ...) \
45 GNUNET_log(kind, __VA_ARGS__) 45 GNUNET_log (kind, __VA_ARGS__)
46 46
47/** 47/**
48 * Debug logging 48 * Debug logging
49 */ 49 */
50#define LOG_DEBUG(...) \ 50#define LOG_DEBUG(...) \
51 LOG(GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) 51 LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
52 52
53/** 53/**
54 * By how much should the arrays lists grow 54 * By how much should the arrays lists grow
@@ -59,7 +59,8 @@
59/** 59/**
60 * A routing entry 60 * A routing entry
61 */ 61 */
62struct Route { 62struct Route
63{
63 /** 64 /**
64 * destination host 65 * destination host
65 */ 66 */
@@ -75,7 +76,8 @@ struct Route {
75/** 76/**
76 * Context information for operations forwarded to subcontrollers 77 * Context information for operations forwarded to subcontrollers
77 */ 78 */
78struct ForwardedOperationContext { 79struct ForwardedOperationContext
80{
79 /** 81 /**
80 * The next pointer for DLL 82 * The next pointer for DLL
81 */ 83 */
@@ -104,7 +106,7 @@ struct ForwardedOperationContext {
104 /** 106 /**
105 * Task ID for the timeout task 107 * Task ID for the timeout task
106 */ 108 */
107 struct GNUNET_SCHEDULER_Task * timeout_task; 109 struct GNUNET_SCHEDULER_Task *timeout_task;
108 110
109 /** 111 /**
110 * The id of the operation that has been forwarded 112 * The id of the operation that has been forwarded
@@ -121,7 +123,8 @@ struct ForwardedOperationContext {
121/** 123/**
122 * A DLL of host registrations to be made 124 * A DLL of host registrations to be made
123 */ 125 */
124struct HostRegistration { 126struct HostRegistration
127{
125 /** 128 /**
126 * next registration in the DLL 129 * next registration in the DLL
127 */ 130 */
@@ -152,7 +155,8 @@ struct HostRegistration {
152/** 155/**
153 * Context information used while linking controllers 156 * Context information used while linking controllers
154 */ 157 */
155struct LinkControllersContext { 158struct LinkControllersContext
159{
156 /** 160 /**
157 * The client which initiated the link controller operation 161 * The client which initiated the link controller operation
158 */ 162 */
@@ -168,9 +172,12 @@ struct LinkControllersContext {
168/** 172/**
169 * A peer 173 * A peer
170 */ 174 */
171struct Peer { 175struct Peer
172 union { 176{
173 struct { 177 union
178 {
179 struct
180 {
174 /** 181 /**
175 * The peer handle from testing API 182 * The peer handle from testing API
176 */ 183 */
@@ -188,7 +195,8 @@ struct Peer {
188 int is_running; 195 int is_running;
189 } local; 196 } local;
190 197
191 struct { 198 struct
199 {
192 /** 200 /**
193 * The slave this peer is started through 201 * The slave this peer is started through
194 */ 202 */
@@ -234,7 +242,8 @@ struct Peer {
234/** 242/**
235 * The main context information associated with the client which started us 243 * The main context information associated with the client which started us
236 */ 244 */
237struct Context { 245struct Context
246{
238 /** 247 /**
239 * The client handle associated with this context 248 * The client handle associated with this context
240 */ 249 */
@@ -260,7 +269,8 @@ struct Context {
260/** 269/**
261 * The structure for identifying a shared service 270 * The structure for identifying a shared service
262 */ 271 */
263struct SharedService { 272struct SharedService
273{
264 /** 274 /**
265 * The name of the shared service 275 * The name of the shared service
266 */ 276 */
@@ -285,7 +295,8 @@ struct RegisteredHostContext;
285 * Context information to used during operations which forward the overlay 295 * Context information to used during operations which forward the overlay
286 * connect message 296 * connect message
287 */ 297 */
288struct ForwardedOverlayConnectContext { 298struct ForwardedOverlayConnectContext
299{
289 /** 300 /**
290 * next ForwardedOverlayConnectContext in the DLL 301 * next ForwardedOverlayConnectContext in the DLL
291 */ 302 */
@@ -337,7 +348,8 @@ struct ForwardedOverlayConnectContext {
337 * This context information will be created for each host that is registered at 348 * This context information will be created for each host that is registered at
338 * slave controllers during overlay connects. 349 * slave controllers during overlay connects.
339 */ 350 */
340struct RegisteredHostContext { 351struct RegisteredHostContext
352{
341 /** 353 /**
342 * The host which is being registered 354 * The host which is being registered
343 */ 355 */
@@ -361,7 +373,8 @@ struct RegisteredHostContext {
361 /** 373 /**
362 * Enumeration of states for this context 374 * Enumeration of states for this context
363 */ 375 */
364 enum RHCState { 376 enum RHCState
377 {
365 /** 378 /**
366 * The initial state 379 * The initial state
367 */ 380 */
@@ -378,7 +391,8 @@ struct RegisteredHostContext {
378/** 391/**
379 * Context data for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler 392 * Context data for #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS handler
380 */ 393 */
381struct HandlerContext_ShutdownPeers { 394struct HandlerContext_ShutdownPeers
395{
382 /** 396 /**
383 * The number of slave we expect to hear from since we forwarded the 397 * The number of slave we expect to hear from since we forwarded the
384 * #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS message to them 398 * #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS message to them
@@ -479,15 +493,15 @@ extern char *GST_stats_dir;
479 */ 493 */
480#define GST_array_grow_large_enough(ptr, size, accommodate_size) \ 494#define GST_array_grow_large_enough(ptr, size, accommodate_size) \
481 do \ 495 do \
482 { \ 496 { \
483 unsigned int growth_size; \ 497 unsigned int growth_size; \
484 GNUNET_assert(size <= accommodate_size); \ 498 GNUNET_assert (size <= accommodate_size); \
485 growth_size = size; \ 499 growth_size = size; \
486 while (growth_size <= accommodate_size) \ 500 while (growth_size <= accommodate_size) \
487 growth_size += LIST_GROW_STEP; \ 501 growth_size += LIST_GROW_STEP; \
488 GNUNET_array_grow (ptr, size, growth_size); \ 502 GNUNET_array_grow (ptr, size, growth_size); \
489 GNUNET_assert(size > accommodate_size); \ 503 GNUNET_assert (size > accommodate_size); \
490 } while (0) 504 } while (0)
491 505
492 506
493/** 507/**
@@ -496,14 +510,14 @@ extern char *GST_stats_dir;
496 * @param peer the peer structure to destroy 510 * @param peer the peer structure to destroy
497 */ 511 */
498void 512void
499GST_destroy_peer(struct Peer *peer); 513GST_destroy_peer (struct Peer *peer);
500 514
501 515
502/** 516/**
503 * Stops and destroys all peers 517 * Stops and destroys all peers
504 */ 518 */
505void 519void
506GST_destroy_peers(void); 520GST_destroy_peers (void);
507 521
508 522
509/** 523/**
@@ -515,7 +529,7 @@ GST_destroy_peers(void);
515 * is found 529 * is found
516 */ 530 */
517struct Route * 531struct Route *
518GST_find_dest_route(uint32_t host_id); 532GST_find_dest_route (uint32_t host_id);
519 533
520 534
521/** 535/**
@@ -525,8 +539,8 @@ GST_find_dest_route(uint32_t host_id);
525 * @param msg the actual message 539 * @param msg the actual message
526 */ 540 */
527void 541void
528handle_overlay_connect(void *cls, 542handle_overlay_connect (void *cls,
529 const struct GNUNET_TESTBED_OverlayConnectMessage *msg); 543 const struct GNUNET_TESTBED_OverlayConnectMessage *msg);
530 544
531 545
532/** 546/**
@@ -539,9 +553,9 @@ handle_overlay_connect(void *cls,
539 * @param host the host which has to be registered 553 * @param host the host which has to be registered
540 */ 554 */
541void 555void
542GST_queue_host_registration(struct Slave *slave, 556GST_queue_host_registration (struct Slave *slave,
543 GNUNET_TESTBED_HostRegistrationCompletion cb, 557 GNUNET_TESTBED_HostRegistrationCompletion cb,
544 void *cb_cls, struct GNUNET_TESTBED_Host *host); 558 void *cb_cls, struct GNUNET_TESTBED_Host *host);
545 559
546 560
547/** 561/**
@@ -551,8 +565,8 @@ GST_queue_host_registration(struct Slave *slave,
551 * @param msg the message to relay 565 * @param msg the message to relay
552 */ 566 */
553void 567void
554GST_forwarded_operation_reply_relay(void *cls, 568GST_forwarded_operation_reply_relay (void *cls,
555 const struct GNUNET_MessageHeader *msg); 569 const struct GNUNET_MessageHeader *msg);
556 570
557 571
558/** 572/**
@@ -562,14 +576,14 @@ GST_forwarded_operation_reply_relay(void *cls,
562 * @param tc the task context from scheduler 576 * @param tc the task context from scheduler
563 */ 577 */
564void 578void
565GST_forwarded_operation_timeout(void *cls); 579GST_forwarded_operation_timeout (void *cls);
566 580
567 581
568/** 582/**
569 * Clears the forwarded operations queue 583 * Clears the forwarded operations queue
570 */ 584 */
571void 585void
572GST_clear_fopcq(void); 586GST_clear_fopcq (void);
573 587
574 588
575/** 589/**
@@ -580,9 +594,9 @@ GST_clear_fopcq(void);
580 * @param emsg the error message; can be NULL 594 * @param emsg the error message; can be NULL
581 */ 595 */
582void 596void
583GST_send_operation_fail_msg(struct GNUNET_SERVICE_Client *client, 597GST_send_operation_fail_msg (struct GNUNET_SERVICE_Client *client,
584 uint64_t operation_id, 598 uint64_t operation_id,
585 const char *emsg); 599 const char *emsg);
586 600
587 601
588/** 602/**
@@ -591,7 +605,7 @@ GST_send_operation_fail_msg(struct GNUNET_SERVICE_Client *client,
591 * @param client the client that disconnected 605 * @param client the client that disconnected
592 */ 606 */
593void 607void
594GST_notify_client_disconnect_oc(struct GNUNET_SERVICE_Client *client); 608GST_notify_client_disconnect_oc (struct GNUNET_SERVICE_Client *client);
595 609
596 610
597/** 611/**
@@ -600,7 +614,7 @@ GST_notify_client_disconnect_oc(struct GNUNET_SERVICE_Client *client);
600 * @param client the client that disconnected 614 * @param client the client that disconnected
601 */ 615 */
602void 616void
603GST_notify_client_disconnect_peers(struct GNUNET_SERVICE_Client *client); 617GST_notify_client_disconnect_peers (struct GNUNET_SERVICE_Client *client);
604 618
605 619
606/** 620/**
@@ -610,8 +624,8 @@ GST_notify_client_disconnect_peers(struct GNUNET_SERVICE_Client *client);
610 * @param operation_id the id of the operation which was successful 624 * @param operation_id the id of the operation which was successful
611 */ 625 */
612void 626void
613GST_send_operation_success_msg(struct GNUNET_SERVICE_Client *client, 627GST_send_operation_success_msg (struct GNUNET_SERVICE_Client *client,
614 uint64_t operation_id); 628 uint64_t operation_id);
615 629
616 630
617/** 631/**
@@ -622,8 +636,9 @@ GST_send_operation_success_msg(struct GNUNET_SERVICE_Client *client,
622 * @return #GNUNET_OK if @a msg is well-formed 636 * @return #GNUNET_OK if @a msg is well-formed
623 */ 637 */
624int 638int
625check_remote_overlay_connect(void *cls, 639check_remote_overlay_connect (void *cls,
626 const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg); 640 const struct
641 GNUNET_TESTBED_RemoteOverlayConnectMessage *msg);
627 642
628 643
629/** 644/**
@@ -633,8 +648,9 @@ check_remote_overlay_connect(void *cls,
633 * @param msg the actual message 648 * @param msg the actual message
634 */ 649 */
635void 650void
636handle_remote_overlay_connect(void *cls, 651handle_remote_overlay_connect (void *cls,
637 const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg); 652 const struct
653 GNUNET_TESTBED_RemoteOverlayConnectMessage *msg);
638 654
639 655
640/** 656/**
@@ -645,8 +661,8 @@ handle_remote_overlay_connect(void *cls,
645 * @return #GNUNET_OK if @a msg is well-formed 661 * @return #GNUNET_OK if @a msg is well-formed
646 */ 662 */
647int 663int
648check_peer_create(void *cls, 664check_peer_create (void *cls,
649 const struct GNUNET_TESTBED_PeerCreateMessage *msg); 665 const struct GNUNET_TESTBED_PeerCreateMessage *msg);
650 666
651 667
652/** 668/**
@@ -656,8 +672,8 @@ check_peer_create(void *cls,
656 * @param message the actual message 672 * @param message the actual message
657 */ 673 */
658void 674void
659handle_peer_create(void *cls, 675handle_peer_create (void *cls,
660 const struct GNUNET_TESTBED_PeerCreateMessage *msg); 676 const struct GNUNET_TESTBED_PeerCreateMessage *msg);
661 677
662 678
663/** 679/**
@@ -667,8 +683,8 @@ handle_peer_create(void *cls,
667 * @param msg the actual message 683 * @param msg the actual message
668 */ 684 */
669void 685void
670handle_peer_destroy(void *cls, 686handle_peer_destroy (void *cls,
671 const struct GNUNET_TESTBED_PeerDestroyMessage *msg); 687 const struct GNUNET_TESTBED_PeerDestroyMessage *msg);
672 688
673 689
674/** 690/**
@@ -678,8 +694,8 @@ handle_peer_destroy(void *cls,
678 * @param msg the actual message 694 * @param msg the actual message
679 */ 695 */
680void 696void
681handle_peer_start(void *cls, 697handle_peer_start (void *cls,
682 const struct GNUNET_TESTBED_PeerStartMessage *msg); 698 const struct GNUNET_TESTBED_PeerStartMessage *msg);
683 699
684 700
685/** 701/**
@@ -689,8 +705,8 @@ handle_peer_start(void *cls,
689 * @param message the actual message 705 * @param message the actual message
690 */ 706 */
691void 707void
692handle_peer_stop(void *cls, 708handle_peer_stop (void *cls,
693 const struct GNUNET_TESTBED_PeerStopMessage *msg); 709 const struct GNUNET_TESTBED_PeerStopMessage *msg);
694 710
695 711
696/** 712/**
@@ -700,8 +716,9 @@ handle_peer_stop(void *cls,
700 * @param msg the actual message 716 * @param msg the actual message
701 */ 717 */
702void 718void
703handle_peer_get_config(void *cls, 719handle_peer_get_config (void *cls,
704 const struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg); 720 const struct
721 GNUNET_TESTBED_PeerGetConfigurationMessage *msg);
705 722
706 723
707/** 724/**
@@ -711,8 +728,8 @@ handle_peer_get_config(void *cls,
711 * @param msg the actual message 728 * @param msg the actual message
712 */ 729 */
713void 730void
714handle_shutdown_peers(void *cls, 731handle_shutdown_peers (void *cls,
715 const struct GNUNET_TESTBED_ShutdownPeersMessage *msg); 732 const struct GNUNET_TESTBED_ShutdownPeersMessage *msg);
716 733
717 734
718/** 735/**
@@ -723,8 +740,9 @@ handle_shutdown_peers(void *cls,
723 * @return #GNUNET_OK if @a msg is well-formed 740 * @return #GNUNET_OK if @a msg is well-formed
724 */ 741 */
725int 742int
726check_manage_peer_service(void *cls, 743check_manage_peer_service (void *cls,
727 const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg); 744 const struct
745 GNUNET_TESTBED_ManagePeerServiceMessage *msg);
728 746
729 747
730/** 748/**
@@ -734,8 +752,9 @@ check_manage_peer_service(void *cls,
734 * @param msg the actual message 752 * @param msg the actual message
735 */ 753 */
736void 754void
737handle_manage_peer_service(void *cls, 755handle_manage_peer_service (void *cls,
738 const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg); 756 const struct
757 GNUNET_TESTBED_ManagePeerServiceMessage *msg);
739 758
740 759
741 760
@@ -748,8 +767,9 @@ handle_manage_peer_service(void *cls,
748 * @return #GNUNET_OK if @a msg is well-formed 767 * @return #GNUNET_OK if @a msg is well-formed
749 */ 768 */
750int 769int
751check_peer_reconfigure(void *cls, 770check_peer_reconfigure (void *cls,
752 const struct GNUNET_TESTBED_PeerReconfigureMessage *msg); 771 const struct
772 GNUNET_TESTBED_PeerReconfigureMessage *msg);
753 773
754 774
755/** 775/**
@@ -761,29 +781,30 @@ check_peer_reconfigure(void *cls,
761 * @param msg the actual message 781 * @param msg the actual message
762 */ 782 */
763void 783void
764handle_peer_reconfigure(void *cls, 784handle_peer_reconfigure (void *cls,
765 const struct GNUNET_TESTBED_PeerReconfigureMessage *msg); 785 const struct
786 GNUNET_TESTBED_PeerReconfigureMessage *msg);
766 787
767 788
768/** 789/**
769 * Frees the ManageServiceContext queue 790 * Frees the ManageServiceContext queue
770 */ 791 */
771void 792void
772GST_free_mctxq(void); 793GST_free_mctxq (void);
773 794
774 795
775/** 796/**
776 * Cleans up the queue used for forwarding link controllers requests 797 * Cleans up the queue used for forwarding link controllers requests
777 */ 798 */
778void 799void
779GST_free_lcf(void); 800GST_free_lcf (void);
780 801
781 802
782/** 803/**
783 * Cleans up the route list 804 * Cleans up the route list
784 */ 805 */
785void 806void
786GST_route_list_clear(void); 807GST_route_list_clear (void);
787 808
788 809
789/** 810/**
@@ -792,7 +813,7 @@ GST_route_list_clear(void);
792 * @param rhc the RegisteredHostContext 813 * @param rhc the RegisteredHostContext
793 */ 814 */
794void 815void
795GST_process_next_focc(struct RegisteredHostContext *rhc); 816GST_process_next_focc (struct RegisteredHostContext *rhc);
796 817
797 818
798/** 819/**
@@ -801,28 +822,28 @@ GST_process_next_focc(struct RegisteredHostContext *rhc);
801 * @param focc the ForwardedOverlayConnectContext to cleanup 822 * @param focc the ForwardedOverlayConnectContext to cleanup
802 */ 823 */
803void 824void
804GST_cleanup_focc(struct ForwardedOverlayConnectContext *focc); 825GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc);
805 826
806 827
807/** 828/**
808 * Clears all pending overlay connect contexts in queue 829 * Clears all pending overlay connect contexts in queue
809 */ 830 */
810void 831void
811GST_free_occq(void); 832GST_free_occq (void);
812 833
813 834
814/** 835/**
815 * Clears all pending remote overlay connect contexts in queue 836 * Clears all pending remote overlay connect contexts in queue
816 */ 837 */
817void 838void
818GST_free_roccq(void); 839GST_free_roccq (void);
819 840
820 841
821/** 842/**
822 * Cleans up the Peer reconfigure context list 843 * Cleans up the Peer reconfigure context list
823 */ 844 */
824void 845void
825GST_free_prcq(void); 846GST_free_prcq (void);
826 847
827 848
828/** 849/**
@@ -831,14 +852,14 @@ GST_free_prcq(void);
831 * @param size the size of the cache 852 * @param size the size of the cache
832 */ 853 */
833void 854void
834GST_cache_init(unsigned int size); 855GST_cache_init (unsigned int size);
835 856
836 857
837/** 858/**
838 * Clear cache 859 * Clear cache
839 */ 860 */
840void 861void
841GST_cache_clear(void); 862GST_cache_clear (void);
842 863
843 864
844/** 865/**
@@ -848,7 +869,7 @@ GST_cache_clear(void);
848 * @return the HELLO message; NULL if not found 869 * @return the HELLO message; NULL if not found
849 */ 870 */
850const struct GNUNET_MessageHeader * 871const struct GNUNET_MessageHeader *
851GST_cache_lookup_hello(const unsigned int peer_id); 872GST_cache_lookup_hello (const unsigned int peer_id);
852 873
853 874
854/** 875/**
@@ -859,8 +880,8 @@ GST_cache_lookup_hello(const unsigned int peer_id);
859 * @param hello the HELLO message 880 * @param hello the HELLO message
860 */ 881 */
861void 882void
862GST_cache_add_hello(const unsigned int peer_id, 883GST_cache_add_hello (const unsigned int peer_id,
863 const struct GNUNET_MessageHeader *hello); 884 const struct GNUNET_MessageHeader *hello);
864 885
865 886
866/** 887/**
@@ -869,13 +890,13 @@ GST_cache_add_hello(const unsigned int peer_id,
869 * generated from the hostname and the process's PID. 890 * generated from the hostname and the process's PID.
870 */ 891 */
871void 892void
872GST_stats_init(const struct GNUNET_CONFIGURATION_Handle *cfg); 893GST_stats_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
873 894
874 895
875/** 896/**
876 * Shutdown the status calls module. 897 * Shutdown the status calls module.
877 */ 898 */
878void 899void
879GST_stats_destroy(void); 900GST_stats_destroy (void);
880 901
881/* End of gnunet-service-testbed.h */ 902/* End of gnunet-service-testbed.h */