aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_ng_lib.h
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2023-07-14 16:59:30 +0200
committert3sserakt <t3ss@posteo.de>2023-07-14 16:59:30 +0200
commit40a5a650d3b61aca9474692416adeba7272e61b3 (patch)
tree0b02421352144cb978a9016ccb1c61f7f1d9519b /src/include/gnunet_testing_ng_lib.h
parentb138491b9e4878607ea954254f84f1106202017b (diff)
downloadgnunet-40a5a650d3b61aca9474692416adeba7272e61b3.tar.gz
gnunet-40a5a650d3b61aca9474692416adeba7272e61b3.zip
NEWS: Added command to execute a script.
Diffstat (limited to 'src/include/gnunet_testing_ng_lib.h')
-rw-r--r--src/include/gnunet_testing_ng_lib.h206
1 files changed, 205 insertions, 1 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index 77e9bd74a..98ba65b59 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -519,6 +519,20 @@ struct GNUNET_TESTING_Timer
519 unsigned int num_retries; 519 unsigned int num_retries;
520}; 520};
521 521
522/**
523 * Command to execute a script synchronously.
524 *
525 * @param label Label of the command.
526 * @param script The name of the script.
527 * @param script_argv The arguments of the script.
528*/
529const struct GNUNET_TESTING_Command
530GNUNET_TESTING_cmd_exec_bash_script (const char *label,
531 const char *script,
532 char *const script_argv[],
533 int argc,
534 GNUNET_ChildCompletedCallback cb);
535
522 536
523/** 537/**
524 * Retrieve peer identity from the test system with the unique node id. 538 * Retrieve peer identity from the test system with the unique node id.
@@ -603,6 +617,188 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
603/* ****** Specific traits supported by this component ******* */ 617/* ****** Specific traits supported by this component ******* */
604 618
605 619
620typedef void *
621(*GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
622 const struct GNUNET_PeerIdentity *peer);
623
624
625/**
626 * Struct to store information needed in callbacks.
627 *
628 */
629struct ConnectPeersState
630{
631 /**
632 * Context for our asynchronous completion.
633 */
634 struct GNUNET_TESTING_AsyncContext ac;
635
636 GNUNET_TESTING_notify_connect_cb notify_connect;
637
638 /**
639 * The testing system of this node.
640 */
641 const struct GNUNET_TESTING_System *tl_system;
642
643 // Label of the cmd which started the test system.
644 const char *create_label;
645
646 /**
647 * Number globally identifying the node.
648 *
649 */
650 uint32_t num;
651
652 /**
653 * Label of the cmd to start a peer.
654 *
655 */
656 const char *start_peer_label;
657
658 /**
659 * The topology of the test setup.
660 */
661 struct GNUNET_TESTING_NetjailTopology *topology;
662
663 /**
664 * Connections to other peers.
665 */
666 struct GNUNET_TESTING_NodeConnection *node_connections_head;
667
668 struct GNUNET_TESTING_Interpreter *is;
669
670 /**
671 * Number of connections.
672 */
673 unsigned int con_num;
674
675 /**
676 * Number of additional connects this cmd will wait for not triggered by this cmd.
677 */
678 unsigned int additional_connects;
679
680 /**
681 * Number of connections we already have a notification for.
682 */
683 unsigned int con_num_notified;
684
685 /**
686 * Number of additional connects this cmd will wait for not triggered by this cmd we already have a notification for.
687 */
688 unsigned int additional_connects_notified;
689
690 /**
691 * Flag indicating, whether the command is waiting for peers to connect that are configured to connect.
692 */
693 unsigned int wait_for_connect;
694};
695
696
697struct GNUNET_TESTING_StartPeerState
698{
699 /**
700 * Context for our asynchronous completion.
701 */
702 struct GNUNET_TESTING_AsyncContext ac;
703
704 /**
705 * The ip of a node.
706 */
707 char *node_ip;
708
709 /**
710 * Receive callback
711 */
712 struct GNUNET_MQ_MessageHandler *handlers;
713
714 /**
715 * GNUnet configuration file used to start a peer.
716 */
717 char *cfgname;
718
719 /**
720 * Peer's configuration
721 */
722 struct GNUNET_CONFIGURATION_Handle *cfg;
723
724 /**
725 * struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
726 */
727 struct GNUNET_TESTING_Peer *peer;
728
729 /**
730 * Peer identity
731 */
732 struct GNUNET_PeerIdentity id;
733
734 /**
735 * Peer's transport service handle
736 */
737 struct GNUNET_TRANSPORT_CoreHandle *th;
738
739 /**
740 * Application handle
741 */
742 struct GNUNET_TRANSPORT_ApplicationHandle *ah;
743
744 /**
745 * Peer's PEERSTORE Handle
746 */
747 struct GNUNET_PEERSTORE_Handle *ph;
748
749 /**
750 * Hello get task
751 */
752 struct GNUNET_SCHEDULER_Task *rh_task;
753
754 /**
755 * Peer's transport get hello handle to retrieve peer's HELLO message
756 */
757 struct GNUNET_PEERSTORE_IterateContext *pic;
758
759 /**
760 * Hello
761 */
762 char *hello;
763
764 /**
765 * Hello size
766 */
767 size_t hello_size;
768
769 /**
770 * The label of the command which was started by calling GNUNET_TESTING_cmd_system_create.
771 */
772 char *system_label;
773
774 /**
775 * An unique number to identify the peer
776 */
777 unsigned int no;
778
779 /**
780 * A map with struct GNUNET_MQ_Handle values for each peer this peer
781 * is connected to.
782 */
783 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
784
785 /**
786 * Test setup for this peer.
787 */
788 const struct GNUNET_TESTING_System *tl_system;
789
790 /**
791 * Callback which is called on neighbour connect events.
792 */
793 GNUNET_TESTING_notify_connect_cb notify_connect;
794
795 /**
796 * Flag indicating, if udp broadcast should be switched on.
797 */
798 enum GNUNET_GenericReturnValue broadcast;
799};
800
801
606/** 802/**
607 * Create headers for a trait with name @a name for 803 * Create headers for a trait with name @a name for
608 * statically allocated data of type @a type. 804 * statically allocated data of type @a type.
@@ -697,7 +893,15 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
697 */ 893 */
698#define GNUNET_TESTING_SIMPLE_TRAITS(op) \ 894#define GNUNET_TESTING_SIMPLE_TRAITS(op) \
699 op (batch_cmds, struct GNUNET_TESTING_Command *) \ 895 op (batch_cmds, struct GNUNET_TESTING_Command *) \
700 op (process, struct GNUNET_OS_Process *) 896 op (process, struct GNUNET_OS_Process *) \
897 op (peer_id, const struct GNUNET_PeerIdentity) \
898 op (connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \
899 op (hello_size, const size_t) \
900 op (hello, const char) \
901 op (application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \
902 op (connect_peer_state, const struct ConnectPeersState) \
903 op (state, const struct GNUNET_TESTING_StartPeerState) \
904 op (broadcast, const enum GNUNET_GenericReturnValue)
701 905
702 906
703/** 907/**