aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am2
-rw-r--r--src/include/gnunet_common.h42
-rw-r--r--src/include/gnunet_configuration_lib.h193
-rw-r--r--src/include/gnunet_container_lib.h3
-rw-r--r--src/include/gnunet_curl_lib.h2
-rw-r--r--src/include/gnunet_db_lib.h44
-rw-r--r--src/include/gnunet_disk_lib.h26
-rw-r--r--src/include/gnunet_json_lib.h304
-rw-r--r--src/include/gnunet_messenger_service.h12
-rw-r--r--src/include/gnunet_pq_lib.h125
-rw-r--r--src/include/gnunet_protocols.h7
-rw-r--r--src/include/gnunet_setu_service.h26
-rw-r--r--src/include/gnunet_testbed_ng_service.h284
-rw-r--r--src/include/gnunet_testing_ng_lib.h74
-rw-r--r--src/include/gnunet_testing_plugin.h7
-rw-r--r--src/include/gnunet_util_lib.h3
-rw-r--r--src/include/platform.h34
17 files changed, 756 insertions, 432 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index d15186342..9c22b5977 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -115,8 +115,8 @@ gnunetinclude_HEADERS = \
115 gnunet_strings_lib.h \ 115 gnunet_strings_lib.h \
116 gnunet_testbed_service.h \ 116 gnunet_testbed_service.h \
117 gnunet_testbed_logger_service.h \ 117 gnunet_testbed_logger_service.h \
118 gnunet_testbed_ng_service.h \
119 gnunet_testing_lib.h \ 118 gnunet_testing_lib.h \
119 gnunet_testing_plugin.h \
120 gnunet_testing_ng_lib.h \ 120 gnunet_testing_ng_lib.h \
121 gnunet_time_lib.h \ 121 gnunet_time_lib.h \
122 gnunet_transport_service.h \ 122 gnunet_transport_service.h \
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index df1ccff26..3ee2a070a 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2006-2020 GNUnet e.V. 3 Copyright (C) 2006-2021 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -135,7 +135,7 @@ enum GNUNET_GenericReturnValue
135 * tree where gnunet_config.h is unavailable 135 * tree where gnunet_config.h is unavailable
136 */ 136 */
137#ifndef GNUNET_EXTRA_LOGGING 137#ifndef GNUNET_EXTRA_LOGGING
138#define GNUNET_EXTRA_LOGGING 0 138#define GNUNET_EXTRA_LOGGING 1
139#endif 139#endif
140 140
141/** 141/**
@@ -875,19 +875,37 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
875 * @ingroup logging 875 * @ingroup logging
876 * Use this for fatal errors that cannot be handled 876 * Use this for fatal errors that cannot be handled
877 */ 877 */
878#if __GNUC__ >= 6 || __clang_major__ >= 6
878#define GNUNET_assert(cond) \ 879#define GNUNET_assert(cond) \
879 do \ 880 do \
880 { \ 881 { \
882 _Pragma("GCC diagnostic push") \
883 _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \
881 if (! (cond)) \ 884 if (! (cond)) \
882 { \ 885 { \
883 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 886 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
884 _ ("Assertion failed at %s:%d. Aborting.\n"), \ 887 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \
885 __FILE__, \ 888 __FILE__, \
886 __LINE__); \ 889 __LINE__); \
887 GNUNET_abort_ (); \ 890 GNUNET_abort_ (); \
888 } \ 891 } \
892 _Pragma("GCC diagnostic pop") \
889 } while (0) 893 } while (0)
890 894#else
895/* older GCC/clangs do not support -Wtautological-compare */
896#define GNUNET_assert(cond) \
897 do \
898 { \
899 if (! (cond)) \
900 { \
901 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
902 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \
903 __FILE__, \
904 __LINE__); \
905 GNUNET_abort_ (); \
906 } \
907 } while (0)
908#endif
891 909
892/** 910/**
893 * @ingroup logging 911 * @ingroup logging
@@ -899,7 +917,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
899 if (! (cond)) \ 917 if (! (cond)) \
900 { \ 918 { \
901 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 919 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
902 _ ("Assertion failed at %s:%d. Aborting.\n"), \ 920 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \
903 f, \ 921 f, \
904 l); \ 922 l); \
905 GNUNET_abort_ (); \ 923 GNUNET_abort_ (); \
@@ -921,7 +939,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
921 { \ 939 { \
922 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \ 940 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \
923 comp, \ 941 comp, \
924 _ ("Assertion failed at %s:%d. Aborting.\n"), \ 942 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \
925 __FILE__, \ 943 __FILE__, \
926 __LINE__); \ 944 __LINE__); \
927 GNUNET_abort_ (); \ 945 GNUNET_abort_ (); \
@@ -962,7 +980,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
962 if (! (cond)) \ 980 if (! (cond)) \
963 { \ 981 { \
964 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 982 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
965 _ ("Assertion failed at %s:%d.\n"), \ 983 dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \
966 __FILE__, \ 984 __FILE__, \
967 __LINE__); \ 985 __LINE__); \
968 } \ 986 } \
@@ -984,7 +1002,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
984 if (! (cond)) \ 1002 if (! (cond)) \
985 { \ 1003 { \
986 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, \ 1004 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, \
987 _ ("External protocol violation detected at %s:%d.\n"), \ 1005 dgettext ("gnunet", "External protocol violation detected at %s:%d.\n"), \
988 __FILE__, \ 1006 __FILE__, \
989 __LINE__); \ 1007 __LINE__); \
990 } \ 1008 } \
@@ -1001,7 +1019,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1001 do \ 1019 do \
1002 { \ 1020 { \
1003 GNUNET_log (level, \ 1021 GNUNET_log (level, \
1004 _ ("`%s' failed at %s:%d with error: %s\n"), \ 1022 dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \
1005 cmd, \ 1023 cmd, \
1006 __FILE__, \ 1024 __FILE__, \
1007 __LINE__, \ 1025 __LINE__, \
@@ -1020,7 +1038,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1020 { \ 1038 { \
1021 GNUNET_log_from (level, \ 1039 GNUNET_log_from (level, \
1022 component, \ 1040 component, \
1023 _ ("`%s' failed at %s:%d with error: %s\n"), \ 1041 dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \
1024 cmd, \ 1042 cmd, \
1025 __FILE__, \ 1043 __FILE__, \
1026 __LINE__, \ 1044 __LINE__, \
@@ -1038,7 +1056,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1038 do \ 1056 do \
1039 { \ 1057 { \
1040 GNUNET_log (level, \ 1058 GNUNET_log (level, \
1041 _ ("`%s' failed on file `%s' at %s:%d with error: %s\n"), \ 1059 dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1042 cmd, \ 1060 cmd, \
1043 filename, \ 1061 filename, \
1044 __FILE__, \ 1062 __FILE__, \
@@ -1058,7 +1076,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1058 { \ 1076 { \
1059 GNUNET_log_from (level, \ 1077 GNUNET_log_from (level, \
1060 component, \ 1078 component, \
1061 _ ("`%s' failed on file `%s' at %s:%d with error: %s\n"), \ 1079 dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1062 cmd, \ 1080 cmd, \
1063 filename, \ 1081 filename, \
1064 __FILE__, \ 1082 __FILE__, \
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 21a5ab810..570546b68 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -113,6 +113,18 @@ GNUNET_CONFIGURATION_default (void);
113 113
114 114
115/** 115/**
116 * Return the filename of the default configuration filename
117 * that is used when no explicit configuration entry point
118 * has been specified.
119 *
120 * @returns NULL if no default configuration file can be located,
121 * a newly allocated string otherwise
122 */
123char *
124GNUNET_CONFIGURATION_default_filename (void);
125
126
127/**
116 * Parse a configuration file, add all of the options in the 128 * Parse a configuration file, add all of the options in the
117 * file to the configuration environment. 129 * file to the configuration environment.
118 * 130 *
@@ -139,21 +151,33 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
139 151
140 152
141/** 153/**
154 * Serializes the given configuration with diagnostics information.
155 * Diagnostics information will only be available if diagnostics
156 * have been enabled before parsing.
157 *
158 * @param cfg configuration to serialize
159 * @return the memory block where the serialized configuration is
160 * present. This memory should be freed by the caller
161 */
162char *
163GNUNET_CONFIGURATION_serialize_diagnostics (const struct
164 GNUNET_CONFIGURATION_Handle *cfg);
165
166/**
142 * De-serializes configuration 167 * De-serializes configuration
143 * 168 *
144 * @param cfg configuration to update 169 * @param cfg configuration to update
145 * @param mem the memory block of serialized configuration 170 * @param mem the memory block of serialized configuration
146 * @param size the size of the memory block 171 * @param size the size of the memory block
147 * @param allow_inline set to the base directory if we recursively load configuration 172 * @param source_filename source filename, will be used
148 * from inlined configurations; NULL if not and raise warnings 173 * to resolve relative @INLINE@ statements
149 * when we come across them
150 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 174 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
151 */ 175 */
152enum GNUNET_GenericReturnValue 176enum GNUNET_GenericReturnValue
153GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, 177GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
154 const char *mem, 178 const char *mem,
155 size_t size, 179 size_t size,
156 const char *basedir); 180 const char *source_filename);
157 181
158 182
159/** 183/**
@@ -235,6 +259,16 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename,
235 GNUNET_CONFIGURATION_Callback cb, 259 GNUNET_CONFIGURATION_Callback cb,
236 void *cb_cls); 260 void *cb_cls);
237 261
262/**
263 * Enable extra diagnostics. Will produce more log output
264 * and allocate more memory.
265 *
266 * @param cfg configuration handle
267 */
268void
269GNUNET_CONFIGURATION_enable_diagnostics (struct
270 GNUNET_CONFIGURATION_Handle *cfg);
271
238 272
239/** 273/**
240 * Function to iterate over options. 274 * Function to iterate over options.
@@ -598,6 +632,157 @@ GNUNET_CONFIGURATION_append_value_filename (struct
598 const char *option, 632 const char *option,
599 const char *value); 633 const char *value);
600 634
635
636/**
637 * Closure for #GNUNET_CONFIGURATION_config_tool_run()
638 * with settings for what should be done with the
639 * configuration.
640 */
641struct GNUNET_CONFIGURATION_ConfigSettings
642{
643
644 /**
645 * Must be set to the API version, i.e.
646 * #GNUNET_UTIL_VERSION. Used to detect
647 * which version of the struct the client
648 * is using.
649 */
650 unsigned int api_version;
651
652 /**
653 * Name of the section
654 */
655 char *section;
656
657 /**
658 * Name of the option
659 */
660 char *option;
661
662 /**
663 * Value to set
664 */
665 char *value;
666
667 /**
668 * Treat option as a filename.
669 */
670 int is_filename;
671
672 /**
673 * Whether to show the sections.
674 */
675 int list_sections;
676
677 /**
678 * Should we write out the configuration file, even if no value was changed?
679 */
680 int rewrite;
681
682 /**
683 * Should we give extra diagnostics?
684 */
685 int diagnostics;
686
687 /**
688 * Should the generated configuration file contain the whole configuration?
689 */
690 int full;
691
692
693 /**
694 * Return value from the operation, to be returned
695 * from 'main'.
696 */
697 int global_ret;
698
699};
700
701
702/**
703 * Macro that expands to a set of GNUNET-getopt directives
704 * to initialize a `struct GNUNET_CONFIGURATION_ConfigSettings`
705 * from the command line.
706 *
707 * @param cs configuration settings to initialize
708 */
709#define GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) \
710 GNUNET_GETOPT_option_flag ( \
711 'F', \
712 "full", \
713 gettext_noop ( \
714 "write the full configuration file, including default values"), \
715 &(cs)->full), \
716 GNUNET_GETOPT_option_flag ( \
717 'f', \
718 "filename", \
719 gettext_noop ("interpret option value as a filename (with $-expansion)"), \
720 &(cs)->is_filename), \
721 GNUNET_GETOPT_option_string ('o', \
722 "option", \
723 "OPTION", \
724 gettext_noop ("name of the option to access"), \
725 &(cs)->option), \
726 GNUNET_GETOPT_option_flag ( \
727 'r', \
728 "rewrite", \
729 gettext_noop ( \
730 "rewrite the configuration file, even if nothing changed"), \
731 &(cs)->rewrite), \
732 GNUNET_GETOPT_option_flag ( \
733 'd', \
734 "diagnostics", \
735 gettext_noop ( \
736 "output extra diagnostics"), \
737 &(cs)->diagnostics), \
738 GNUNET_GETOPT_option_flag ('S', \
739 "list-sections", \
740 gettext_noop ( \
741 "print available configuration sections"), \
742 &(cs)->list_sections), \
743 GNUNET_GETOPT_option_string ('s', \
744 "section", \
745 "SECTION", \
746 gettext_noop ( \
747 "name of the section to access"), \
748 &(cs)->section), \
749 GNUNET_GETOPT_option_string ('V', \
750 "value", \
751 "VALUE", \
752 gettext_noop ("value to set"), \
753 &(cs)->value)
754
755
756/**
757 * Free resources associated with @a cs.
758 *
759 * @param[in] cs settings to free (actual memory
760 * of @a cs itself is not released)
761 */
762void
763GNUNET_CONFIGURATION_config_settings_free (
764 struct GNUNET_CONFIGURATION_ConfigSettings *cs);
765
766
767/**
768 * Main task to run to perform operations typical for
769 * gnunet-config as per the configuration settings
770 * given in @a cls.
771 *
772 * @param cls closure with the `struct GNUNET_CONFIGURATION_ConfigSettings`
773 * @param args remaining command-line arguments
774 * @param cfgfile name of the configuration file used (for saving,
775 * can be NULL!)
776 * @param cfg configuration
777 */
778void
779GNUNET_CONFIGURATION_config_tool_run (
780 void *cls,
781 char *const *args,
782 const char *cfgfile,
783 const struct GNUNET_CONFIGURATION_Handle *cfg);
784
785
601#if 0 /* keep Emacsens' auto-indent happy */ 786#if 0 /* keep Emacsens' auto-indent happy */
602{ 787{
603#endif 788#endif
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index c8930746d..3eb80595c 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -2608,7 +2608,8 @@ GNUNET_CONTAINER_heap_node_get_cost (
2608 * @return #GNUNET_YES if we should continue to iterate, 2608 * @return #GNUNET_YES if we should continue to iterate,
2609 * #GNUNET_NO if not. 2609 * #GNUNET_NO if not.
2610 */ 2610 */
2611typedef int (*GNUNET_CONTAINER_HeapIterator) ( 2611typedef int
2612(*GNUNET_CONTAINER_HeapIterator) (
2612 void *cls, 2613 void *cls,
2613 struct GNUNET_CONTAINER_HeapNode *node, 2614 struct GNUNET_CONTAINER_HeapNode *node,
2614 void *element, 2615 void *element,
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h
index f51e4b503..38acecc48 100644
--- a/src/include/gnunet_curl_lib.h
+++ b/src/include/gnunet_curl_lib.h
@@ -150,7 +150,7 @@ GNUNET_CURL_get_select_info (struct GNUNET_CURL_Context *ctx,
150 * @param header header string; will be given to the context AS IS. 150 * @param header header string; will be given to the context AS IS.
151 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise. 151 * @return #GNUNET_OK if no errors occurred, #GNUNET_SYSERR otherwise.
152 */ 152 */
153int 153enum GNUNET_GenericReturnValue
154GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx, 154GNUNET_CURL_append_header (struct GNUNET_CURL_Context *ctx,
155 const char *header); 155 const char *header);
156 156
diff --git a/src/include/gnunet_db_lib.h b/src/include/gnunet_db_lib.h
index 85ad13e31..e88e836f6 100644
--- a/src/include/gnunet_db_lib.h
+++ b/src/include/gnunet_db_lib.h
@@ -25,6 +25,7 @@
25#ifndef GNUNET_DB_LIB_H 25#ifndef GNUNET_DB_LIB_H
26#define GNUNET_DB_LIB_H 26#define GNUNET_DB_LIB_H
27 27
28#include "gnunet_common.h"
28 29
29/** 30/**
30 * Status code returned from functions running database commands. 31 * Status code returned from functions running database commands.
@@ -61,4 +62,47 @@ enum GNUNET_DB_QueryStatus
61 that returned more than one result. */ 62 that returned more than one result. */
62}; 63};
63 64
65
66/**
67 * Handle for an active LISTENer to a database.
68 */
69struct GNUNET_DB_EventHandler;
70
71/**
72 * Function called on events received from Postgres.
73 *
74 * @param cls closure
75 * @param extra additional event data provided
76 * @param extra_size number of bytes in @a extra
77 */
78typedef void
79(*GNUNET_DB_EventCallback)(void *cls,
80 const void *extra,
81 size_t extra_size);
82
83GNUNET_NETWORK_STRUCT_BEGIN
84
85
86/**
87 * Header of a structure that describes an
88 * event channel we may subscribe to or notify on.
89 */
90struct GNUNET_DB_EventHeaderP
91{
92 /**
93 * The length of the struct (in bytes, including the length field itself),
94 * in big-endian format.
95 */
96 uint16_t size GNUNET_PACKED;
97
98 /**
99 * The type of the message (GNUNET_DB_EVENT_TYPE_XXXX), in big-endian format.
100 */
101 uint16_t type GNUNET_PACKED;
102
103};
104
105GNUNET_NETWORK_STRUCT_END
106
107
64#endif 108#endif
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 3805039fc..7dfd9ccf1 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -266,6 +266,16 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h);
266enum GNUNET_GenericReturnValue 266enum GNUNET_GenericReturnValue
267GNUNET_DISK_file_test (const char *fil); 267GNUNET_DISK_file_test (const char *fil);
268 268
269/**
270 * Check that fil corresponds to a filename and the file has read permissions.
271 *
272 * @param fil filename to check
273 * @return #GNUNET_YES if yes, #GNUNET_NO if file doesn't exist or
274 * has no read permissions, #GNUNET_SYSERR if something else
275 * (will print an error message in that case, too).
276 */
277enum GNUNET_GenericReturnValue
278GNUNET_DISK_file_test_read (const char *fil);
269 279
270/** 280/**
271 * Move a file out of the way (create a backup) by renaming it to "orig.NUM~" 281 * Move a file out of the way (create a backup) by renaming it to "orig.NUM~"
@@ -654,6 +664,22 @@ GNUNET_DISK_directory_scan (const char *dir_name,
654 GNUNET_FileNameCallback callback, 664 GNUNET_FileNameCallback callback,
655 void *callback_cls); 665 void *callback_cls);
656 666
667/**
668 * Find all files matching a glob pattern.
669 *
670 * Currently, the glob_pattern only supports asterisks in the last
671 * path component.
672 *
673 * @param glob_patterb the glob pattern to search for
674 * @param callback the method to call for each file
675 * @param callback_cls closure for @a callback
676 * @return the number of files found, -1 on error
677 */
678int
679GNUNET_DISK_glob (const char *glob_pattern,
680 GNUNET_FileNameCallback callback,
681 void *callback_cls);
682
657 683
658/** 684/**
659 * Create the directory structure for storing 685 * Create the directory structure for storing
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 3dc79105e..92f696e08 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -521,6 +521,310 @@ GNUNET_JSON_getopt (char shortName,
521 const char *description, 521 const char *description,
522 json_t **json); 522 json_t **json);
523 523
524
525/* ****************** JSON PACK helper ******************* */
526
527
528/**
529 * Element in the array to give to the packer.
530 */
531struct GNUNET_JSON_PackSpec;
532
533
534/**
535 * Function called to pack an element into the JSON
536 * object as part of #GNUNET_JSON_pack_().
537 *
538 * @param se pack specification to execute
539 * @return json object to pack, NULL to pack nothing
540 */
541typedef json_t *
542(*GNUNET_JSON_PackCallback)(const struct GNUNET_JSON_PackSpec *se);
543
544
545/**
546 * Element in the array to give to the packer.
547 */
548struct GNUNET_JSON_PackSpec
549{
550 /**
551 * Name of the field to pack.
552 */
553 const char *field_name;
554
555 /**
556 * Object to pack.
557 */
558 json_t *object;
559
560 /**
561 * True if a NULL (or 0) argument is allowed. In this
562 * case, if the argument is NULL the @e packer should
563 * return NULL and the field should be skipped (omitted from
564 * the generated object) and not be serialized at all.
565 */
566 bool allow_null;
567};
568
569
570/**
571 * Pack a JSON object from a @a spec. Aborts if
572 * packing fails.
573 *
574 * @param spec specification object
575 * @return JSON object
576 */
577json_t *
578GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]);
579
580
581/**
582 * Pack a JSON object from a @a spec. Aborts if
583 * packing fails.
584 *
585 * @param ... list of specification objects
586 * @return JSON object
587 */
588#define GNUNET_JSON_PACK(...) \
589 GNUNET_JSON_pack_ ((struct GNUNET_JSON_PackSpec[]) {__VA_ARGS__, \
590 GNUNET_JSON_pack_end_ ()})
591
592
593/**
594 * Do not use directly. Use #GNUNET_JSON_PACK.
595 *
596 * @return array terminator
597 */
598struct GNUNET_JSON_PackSpec
599GNUNET_JSON_pack_end_ (void);
600
601
602/**
603 * Modify packer instruction to allow NULL as a value.
604 *
605 * @param in json pack specification to modify
606 * @return json pack specification
607 */
608struct GNUNET_JSON_PackSpec
609GNUNET_JSON_pack_allow_null (struct GNUNET_JSON_PackSpec in);
610
611
612/**
613 * Generate packer instruction for a JSON field of type
614 * bool.
615 *
616 * @param name name of the field to add to the object
617 * @param b boolean value
618 * @return json pack specification
619 */
620struct GNUNET_JSON_PackSpec
621GNUNET_JSON_pack_bool (const char *name,
622 bool b);
623
624
625/**
626 * Generate packer instruction for a JSON field of type
627 * string.
628 *
629 * @param name name of the field to add to the object
630 * @param s string value
631 * @return json pack specification
632 */
633struct GNUNET_JSON_PackSpec
634GNUNET_JSON_pack_string (const char *name,
635 const char *s);
636
637
638/**
639 * Generate packer instruction for a JSON field of type
640 * unsigned integer. Note that the maximum allowed
641 * value is still limited by JSON and not UINT64_MAX.
642 *
643 * @param name name of the field to add to the object
644 * @param num numeric value
645 * @return json pack specification
646 */
647struct GNUNET_JSON_PackSpec
648GNUNET_JSON_pack_uint64 (const char *name,
649 uint64_t num);
650
651
652/**
653 * Generate packer instruction for a JSON field of type
654 * signed integer.
655 *
656 * @param name name of the field to add to the object
657 * @param num numeric value
658 * @return json pack specification
659 */
660struct GNUNET_JSON_PackSpec
661GNUNET_JSON_pack_int64 (const char *name,
662 int64_t num);
663
664
665/**
666 * Generate packer instruction for a JSON field of type
667 * JSON object where the reference is taken over by
668 * the packer.
669 *
670 * @param name name of the field to add to the object
671 * @param o object to steal
672 * @return json pack specification
673 */
674struct GNUNET_JSON_PackSpec
675GNUNET_JSON_pack_object_steal (const char *name,
676 json_t *o);
677
678
679/**
680 * Generate packer instruction for a JSON field of type JSON object where the
681 * reference counter is incremented by the packer. Note that a deep copy is
682 * not performed.
683 *
684 * @param name name of the field to add to the object
685 * @param o object to increment reference counter of
686 * @return json pack specification
687 */
688struct GNUNET_JSON_PackSpec
689GNUNET_JSON_pack_object_incref (const char *name,
690 json_t *o);
691
692
693/**
694 * Generate packer instruction for a JSON field of type
695 * JSON array where the reference is taken over by
696 * the packer.
697 *
698 * @param name name of the field to add to the object
699 * @param a array to steal
700 * @return json pack specification
701 */
702struct GNUNET_JSON_PackSpec
703GNUNET_JSON_pack_array_steal (const char *name,
704 json_t *a);
705
706
707/**
708 * Generate packer instruction for a JSON field of type JSON array where the
709 * reference counter is incremented by the packer. Note that a deep copy is
710 * not performed.
711 *
712 * @param name name of the field to add to the object
713 * @param a array to increment reference counter of
714 * @return json pack specification
715 */
716struct GNUNET_JSON_PackSpec
717GNUNET_JSON_pack_array_incref (const char *name,
718 json_t *a);
719
720
721/**
722 * Generate packer instruction for a JSON field of type
723 * variable size binary blob.
724 *
725 * @param name name of the field to add to the object
726 * @param blob binary data to pack
727 * @param blob_size number of bytes in @a blob
728 * @return json pack specification
729 */
730struct GNUNET_JSON_PackSpec
731GNUNET_JSON_pack_data_varsize (const char *name,
732 const void *blob,
733 size_t blob_size);
734
735
736/**
737 * Generate packer instruction for a JSON field where the
738 * size is automatically determined from the argument.
739 *
740 * @param name name of the field to add to the object
741 * @param blob data to pack, must not be an array
742 * @return json pack specification
743 */
744#define GNUNET_JSON_pack_data_auto(name,blob) \
745 GNUNET_JSON_pack_data_varsize (name, blob, sizeof (*blob))
746
747
748/**
749 * Generate packer instruction for a JSON field of type
750 * absolute time.
751 *
752 * @param name name of the field to add to the object
753 * @param at absolute time to pack, a value of 0 is only
754 * allowed with #GNUNET_JSON_pack_allow_null()!
755 * @return json pack specification
756 */
757struct GNUNET_JSON_PackSpec
758GNUNET_JSON_pack_time_abs (const char *name,
759 struct GNUNET_TIME_Absolute at);
760
761
762/**
763 * Generate packer instruction for a JSON field of type
764 * absolute time in network byte order.
765 *
766 * @param name name of the field to add to the object
767 * @param at absolute time to pack, a value of 0 is only
768 * allowed with #GNUNET_JSON_pack_allow_null()!
769 * @return json pack specification
770 */
771struct GNUNET_JSON_PackSpec
772GNUNET_JSON_pack_time_abs_nbo (const char *name,
773 struct GNUNET_TIME_AbsoluteNBO at);
774
775
776/**
777 * Generate packer instruction for a JSON field of type
778 * relative time.
779 *
780 * @param name name of the field to add to the object
781 * @param rt relative time to pack
782 * @return json pack specification
783 */
784struct GNUNET_JSON_PackSpec
785GNUNET_JSON_pack_time_rel (const char *name,
786 struct GNUNET_TIME_Relative rt);
787
788
789/**
790 * Generate packer instruction for a JSON field of type
791 * relative time in network byte order.
792 *
793 * @param name name of the field to add to the object
794 * @param rt relative time to pack
795 * @return json pack specification
796 */
797struct GNUNET_JSON_PackSpec
798GNUNET_JSON_pack_time_rel_nbo (const char *name,
799 struct GNUNET_TIME_RelativeNBO rt);
800
801
802/**
803 * Generate packer instruction for a JSON field of type
804 * RSA public key.
805 *
806 * @param name name of the field to add to the object
807 * @param pk RSA public key
808 * @return json pack specification
809 */
810struct GNUNET_JSON_PackSpec
811GNUNET_JSON_pack_rsa_public_key (const char *name,
812 const struct GNUNET_CRYPTO_RsaPublicKey *pk);
813
814
815/**
816 * Generate packer instruction for a JSON field of type
817 * RSA signature.
818 *
819 * @param name name of the field to add to the object
820 * @param sig RSA signature
821 * @return json pack specification
822 */
823struct GNUNET_JSON_PackSpec
824GNUNET_JSON_pack_rsa_signature (const char *name,
825 const struct GNUNET_CRYPTO_RsaSignature *sig);
826
827
524#endif 828#endif
525 829
526/* end of gnunet_json_lib.h */ 830/* end of gnunet_json_lib.h */
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index ecd856eb9..5d7155a3d 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -499,6 +499,7 @@ struct GNUNET_MESSENGER_Message
499 499
500/** 500/**
501 * Enum for the different supported flags used by message handling 501 * Enum for the different supported flags used by message handling
502 * Compatible flags can be OR'ed together.
502 */ 503 */
503enum GNUNET_MESSENGER_MessageFlags 504enum GNUNET_MESSENGER_MessageFlags
504{ 505{
@@ -508,9 +509,14 @@ enum GNUNET_MESSENGER_MessageFlags
508 GNUNET_MESSENGER_FLAG_NONE = 0, 509 GNUNET_MESSENGER_FLAG_NONE = 0,
509 510
510 /** 511 /**
512 * The sent flag. The flag indicates that the message was sent by the client.
513 */
514 GNUNET_MESSENGER_FLAG_SENT = 1,
515
516 /**
511 * The private flag. The flag indicates that the message was privately encrypted. 517 * The private flag. The flag indicates that the message was privately encrypted.
512 */ 518 */
513 GNUNET_MESSENGER_FLAG_PRIVATE = 1, 519 GNUNET_MESSENGER_FLAG_PRIVATE = 2,
514}; 520};
515 521
516/** 522/**
@@ -526,8 +532,8 @@ typedef void
526/** 532/**
527 * Method called whenever a message is sent or received from a <i>room</i>. 533 * Method called whenever a message is sent or received from a <i>room</i>.
528 * 534 *
529 * The flag <i>private_message</i> will be #GNUNET_YES if a message was 535 * The <i>flags</i> will indicate with a bitmask if a message was
530 * received privately, otherwise #GNUNET_NO. 536 * received privately or if the message was sent by the client.
531 * 537 *
532 * @param[in/out] cls Closure from #GNUNET_MESSENGER_connect 538 * @param[in/out] cls Closure from #GNUNET_MESSENGER_connect
533 * @param[in] room Room handle 539 * @param[in] room Room handle
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 1f2915165..fe3fabbea 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -853,113 +853,8 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db);
853 853
854 854
855/** 855/**
856 * Function called whenever the socket needed for
857 * notifications from postgres changes.
858 *
859 * @param cls closure
860 * @param fd socket to listen on, -1 for none
861 */
862typedef void
863(*GNUNET_PQ_SocketCallback)(void *cls,
864 int fd);
865
866
867/**
868 * Obtain the file descriptor to poll on for notifications.
869 * Useful if the GNUnet scheduler is NOT to be used for
870 * such notifications.
871 *
872 * @param db database handle
873 * @param sc function to call with the socket
874 * @param sc_cls closure for @a sc
875 */
876void
877GNUNET_PQ_event_set_socket_callback (struct GNUNET_PQ_Context *db,
878 GNUNET_PQ_SocketCallback sc,
879 void *sc_cls);
880
881
882/**
883 * Poll for database events now. Used if the event FD
884 * is ready and the application wants to trigger applicable
885 * events.
886 * Useful if the GNUnet scheduler is NOT to be used for
887 * such notifications.
888 *
889 * @param db database handle
890 */
891void
892GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db);
893
894
895/**
896 * Run poll event loop using the GNUnet scheduler.
897 *
898 * @param db database handle
899 */
900void
901GNUNET_PQ_event_scheduler_start (struct GNUNET_PQ_Context *db);
902
903
904/**
905 * Stop running poll event loop using the GNUnet scheduler.
906 *
907 * @param db database handle
908 */
909void
910GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db);
911
912
913/**
914 * Handle for an active LISTENer to the database.
915 */
916struct GNUNET_PQ_EventHandler;
917
918/**
919 * Function called on events received from Postgres.
920 *
921 * @param cls closure
922 * @param extra additional event data provided
923 * @param extra_size number of bytes in @a extra
924 */
925typedef void
926(*GNUNET_PQ_EventCallback)(void *cls,
927 const void *extra,
928 size_t extra_size);
929
930GNUNET_NETWORK_STRUCT_BEGIN
931
932
933/**
934 * Header of a structure that describes an
935 * event channel we may subscribe to or notify on.
936 */
937struct GNUNET_PQ_EventHeaderP
938{
939 /**
940 * The length of the struct (in bytes, including the length field itself),
941 * in big-endian format.
942 */
943 uint16_t size GNUNET_PACKED;
944
945 /**
946 * The type of the message (GNUNET_PQ_EVENT_TYPE_XXXX), in big-endian format.
947 */
948 uint16_t type GNUNET_PACKED;
949
950};
951
952GNUNET_NETWORK_STRUCT_END
953
954
955/**
956 * Handle for an active LISTENer to the database.
957 */
958struct GNUNET_PQ_EventHandler;
959
960/**
961 * Register callback to be invoked on events of type @a es. 856 * Register callback to be invoked on events of type @a es.
962 * 857 *
963 * Unlike many other calls, this function is thread-safe 858 * Unlike many other calls, this function is thread-safe
964 * and may be called from threads that are different 859 * and may be called from threads that are different
965 * from the one that setup @a db. However, the @a cb 860 * from the one that setup @a db. However, the @a cb
@@ -968,21 +863,23 @@ struct GNUNET_PQ_EventHandler;
968 * 863 *
969 * @param db database context to use 864 * @param db database context to use
970 * @param es specification of the event to listen for 865 * @param es specification of the event to listen for
866 * @param timeout when to trigger @a cb based on timeout
971 * @param cb function to call when the event happens, possibly 867 * @param cb function to call when the event happens, possibly
972 * multiple times (until #GNUNET_PQ_event_listen_cancel() is invoked) 868 * multiple times (until #GNUNET_PQ_event_listen_cancel() is invoked), including on timeout
973 * @param cb_cls closure for @a cb 869 * @param cb_cls closure for @a cb
974 * @return handle useful to cancel the listener 870 * @return handle useful to cancel the listener
975 */ 871 */
976struct GNUNET_PQ_EventHandler * 872struct GNUNET_DB_EventHandler *
977GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, 873GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db,
978 const struct GNUNET_PQ_EventHeaderP *es, 874 const struct GNUNET_DB_EventHeaderP *es,
979 GNUNET_PQ_EventCallback cb, 875 struct GNUNET_TIME_Relative timeout,
876 GNUNET_DB_EventCallback cb,
980 void *cb_cls); 877 void *cb_cls);
981 878
982 879
983/** 880/**
984 * Stop notifications. 881 * Stop notifications.
985 * 882 *
986 * Unlike many other calls, this function is thread-safe 883 * Unlike many other calls, this function is thread-safe
987 * and may be called from threads that are different 884 * and may be called from threads that are different
988 * from the one that setup @a db. However, the @a cb 885 * from the one that setup @a db. However, the @a cb
@@ -992,12 +889,12 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db,
992 * @param eh handle to unregister. 889 * @param eh handle to unregister.
993 */ 890 */
994void 891void
995GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh); 892GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh);
996 893
997 894
998/** 895/**
999 * Notify all that listen on @a es of an event. 896 * Notify all that listen on @a es of an event.
1000 * 897 *
1001 * Unlike many other calls, this function is thread-safe 898 * Unlike many other calls, this function is thread-safe
1002 * and may be called from threads that are different 899 * and may be called from threads that are different
1003 * from the one that setup @a db. However, the @a cb 900 * from the one that setup @a db. However, the @a cb
@@ -1011,7 +908,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh);
1011 */ 908 */
1012void 909void
1013GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, 910GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db,
1014 const struct GNUNET_PQ_EventHeaderP *es, 911 const struct GNUNET_DB_EventHeaderP *es,
1015 const void *extra, 912 const void *extra,
1016 size_t extra_size); 913 size_t extra_size);
1017 914
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 715e94c6a..6b61dfc72 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1784,6 +1784,13 @@ extern "C" {
1784 */ 1784 */
1785#define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER 572 1785#define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER 572
1786 1786
1787/**
1788 * Signals other peer that all elements are sent.
1789 */
1790
1791#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL 710
1792
1793
1787 1794
1788/******************************************************************************* 1795/*******************************************************************************
1789 * SETI message types 1796 * SETI message types
diff --git a/src/include/gnunet_setu_service.h b/src/include/gnunet_setu_service.h
index bacec9408..1d7e48402 100644
--- a/src/include/gnunet_setu_service.h
+++ b/src/include/gnunet_setu_service.h
@@ -163,7 +163,31 @@ enum GNUNET_SETU_OptionType
163 /** 163 /**
164 * Notify client also if we are sending a value to the other peer. 164 * Notify client also if we are sending a value to the other peer.
165 */ 165 */
166 GNUNET_SETU_OPTION_SYMMETRIC = 8 166 GNUNET_SETU_OPTION_SYMMETRIC = 8,
167
168 /**
169 * Byzantine upper bound. Is the maximal plausible number of elements
170 * a peer can have default max uint64
171 */
172 GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND = 16,
173
174 /**
175 * Bandwidth latency tradeoff determines how much bytes a single RTT is
176 * worth, which is a performance setting
177 */
178 GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF= 32,
179
180 /**
181 * The factor determines the number of buckets an IBF has which is
182 * multiplied by the estimated setsize default: 2
183 */
184 GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR= 64,
185
186 /**
187 * This setting determines to how many IBF buckets an single elements
188 * is mapped to.
189 */
190 GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT= 128
167}; 191};
168 192
169 193
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h
deleted file mode 100644
index 49e9f56bc..000000000
--- a/src/include/gnunet_testbed_ng_service.h
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @author t3sserakt
23 *
24 * @file
25 * API for writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
26 *
27 * @defgroup testbed Testbed service
28 * Writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
29 *
30 * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem)
31 *
32 * @{
33 */
34
35#ifndef GNUNET_TESTBED_NG_SERVICE_H
36#define GNUNET_TESTBED_NG_SERVICE_H
37
38#include "gnunet_util_lib.h"
39#include "gnunet_testing_ng_lib.h"
40
41struct TngState;
42
43struct PeerCmdState
44{
45 /**
46 * The label of a controller command.
47 */
48 const char *controller_label;
49
50 /**
51 * Handle to operation
52 */
53 struct GNUNET_TESTBED_Operation *operation;
54
55 /**
56 * Name of the host, use "NULL" for localhost.
57 */
58 const char *hostname;
59
60 /**
61 * Username to use for the login; may be NULL.
62 */
63 const char *username;
64
65 /**
66 * Port number to use for ssh; use 0 to let ssh decide.
67 */
68 uint16_t port;
69
70 /**
71 * The configuration to use as a template while starting a controller
72 * on this host. Operation queue sizes specific to a host are also
73 * read from this configuration handle.
74 */
75 struct GNUNET_CONFIGURATION_Handle *cfg;
76
77 /**
78 * The host to run peers and controllers on
79 */
80 struct GNUNET_TESTBED_Host *host;
81
82 /**
83 * Abort task identifier
84 */
85 struct GNUNET_SCHEDULER_Task *abort_task;
86
87 /**
88 * Flag indicating if peer is ready.
89 */
90 int peer_ready;
91
92 /**
93 * Flag indicating controller is going down.
94 */
95 int peer_going_down;
96
97 /**
98 * Interpreter state.
99 */
100 struct GNUNET_TESTING_Interpreter *is;
101
102 /**
103 * Peer to start
104 */
105 struct GNUNET_TESTBED_Peer *peer;
106};
107
108struct ControllerState
109{
110 /**
111 * The ip address of the controller which will be set as TRUSTED
112 * HOST(all connections form this ip are permitted by the testbed) when
113 * starting testbed controller at host. This can either be a single ip
114 * address or a network address in CIDR notation.
115 */
116 const char *trusted_ip;
117
118 /**
119 * Name of the host, use "NULL" for localhost.
120 */
121 const char *hostname;
122
123 /**
124 * Username to use for the login; may be NULL.
125 */
126 const char *username;
127
128 /**
129 * Port number to use for ssh; use 0 to let ssh decide.
130 */
131 uint16_t port;
132
133 /**
134 * The configuration to use as a template while starting a controller
135 * on this host. Operation queue sizes specific to a host are also
136 * read from this configuration handle.
137 */
138 struct GNUNET_CONFIGURATION_Handle *cfg;
139
140 /**
141 * The host to run peers and controllers on
142 */
143 struct GNUNET_TESTBED_Host *host;
144
145 /**
146 * The controller process
147 */
148 struct GNUNET_TESTBED_ControllerProc *cp;
149
150 /**
151 * The controller handle
152 */
153 struct GNUNET_TESTBED_Controller *controller;
154
155 /**
156 * A bit mask with set of events to call the controller for.
157 */
158 uint64_t event_mask;
159
160 /**
161 * Abort task identifier
162 */
163 struct GNUNET_SCHEDULER_Task *abort_task;
164
165 /**
166 * Handle for host registration
167 */
168 struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
169
170 /**
171 * Flag indicating if host create with controller is ready.
172 */
173 int host_ready;
174
175 /**
176 * Flag indicating controller is going down.
177 */
178 int controller_going_down;
179
180 /**
181 * Interpreter state.
182 */
183 struct GNUNET_TESTING_Interpreter *is;
184};
185
186/**
187 * Offer data from trait
188 *
189 * @param cmd command to extract the controller from.
190 * @param pt pointer to controller.
191 * @return #GNUNET_OK on success.
192 */
193int
194GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
195 struct GNUNET_TESTBED_Controller **
196 controller);
197
198struct GNUNET_TESTING_Command
199GNUNET_TESTBED_cmd_controller (const char *label,
200 const char *host,
201 uint64_t event_mask);
202
203void
204GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs);
205
206void
207GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps);
208
209void
210GNUNET_TESTBED_shutdown_service (struct TngState *ss);
211
212/**
213 * Create command.
214 *
215 * @param label name for command.
216 * @param binaryname to start.
217 * @return command.
218 */
219struct GNUNET_TESTING_Command
220GNUNET_TESTBED_cmd_netjail_start (const char *label,
221 char *local_m,
222 char *global_n);
223
224
225/**
226 * Create command.
227 *
228 * @param label name for command.
229 * @param binaryname to exec.
230 * @return command.
231 */
232struct GNUNET_TESTING_Command
233GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label,
234 char *local_m,
235 char *global_n,
236 char *plugin_name);
237
238
239/**
240 * Create command.
241 *
242 * @param label name for command.
243 * @param binaryname to stop.
244 * @return command.
245 */
246struct GNUNET_TESTING_Command
247GNUNET_TESTBED_cmd_netjail_stop (const char *label,
248 char *local_m,
249 char *global_n);
250
251
252struct GNUNET_TESTING_Command
253GNUNET_TESTBED_cmd_stop_testbed (const char *label,
254 const char *helper_start_label,
255 char *local_m,
256 char *global_n);
257
258
259int
260GNUNET_TESTBED_get_trait_helper_handles (const struct
261 GNUNET_TESTING_Command *cmd,
262 struct GNUNET_HELPER_Handle ***helper);
263
264
265int
266GNUNET_TESTBED_get_trait_hosts (const struct
267 GNUNET_TESTING_Command *cmd,
268 struct GNUNET_TESTBED_Host ***hosts);
269
270struct GNUNET_TESTING_Command
271GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
272 unsigned int *
273 all_peers_started);
274
275struct GNUNET_TESTING_Command
276GNUNET_TESTING_cmd_send_peer_ready (const char *label,
277 TESTBED_CMD_HELPER_write_cb write_message);
278
279struct GNUNET_TESTING_Command
280GNUNET_TESTING_cmd_local_test_finished (const char *label,
281 TESTBED_CMD_HELPER_write_cb
282 write_message);
283
284#endif
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index aad7ddec2..939863d67 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -838,8 +838,82 @@ GNUNET_TESTING_get_trait_test_system (const struct
838 GNUNET_TESTING_Command *cmd, 838 GNUNET_TESTING_Command *cmd,
839 struct GNUNET_TESTING_System **test_system); 839 struct GNUNET_TESTING_System **test_system);
840 840
841
841struct GNUNET_TESTING_Command 842struct GNUNET_TESTING_Command
842GNUNET_TESTING_cmd_system_create (const char *label, 843GNUNET_TESTING_cmd_system_create (const char *label,
843 const char *testdir); 844 const char *testdir);
844 845
846
847struct GNUNET_TESTING_Command
848GNUNET_TESTING_cmd_system_destroy (const char *label,
849 const char *create_label);
850
851
852/**
853 * Create command.
854 *
855 * @param label name for command.
856 * @param binaryname to start.
857 * @return command.
858 */
859struct GNUNET_TESTING_Command
860GNUNET_TESTING_cmd_netjail_start (const char *label,
861 char *local_m,
862 char *global_n);
863
864
865/**
866 * Create command.
867 *
868 * @param label name for command.
869 * @param binaryname to exec.
870 * @return command.
871 */
872struct GNUNET_TESTING_Command
873GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
874 char *local_m,
875 char *global_n,
876 char *plugin_name,
877 unsigned int *rv);
878
879
880/**
881 * Create command.
882 *
883 * @param label name for command.
884 * @param binaryname to stop.
885 * @return command.
886 */
887struct GNUNET_TESTING_Command
888GNUNET_TESTING_cmd_netjail_stop (const char *label,
889 char *local_m,
890 char *global_n);
891
892
893struct GNUNET_TESTING_Command
894GNUNET_TESTING_cmd_stop_testing_system (const char *label,
895 const char *helper_start_label,
896 char *local_m,
897 char *global_n);
898
899
900int
901GNUNET_TESTING_get_trait_helper_handles (const struct
902 GNUNET_TESTING_Command *cmd,
903 struct GNUNET_HELPER_Handle ***helper);
904
905
906struct GNUNET_TESTING_Command
907GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
908 unsigned int *
909 all_peers_started);
910
911struct GNUNET_TESTING_Command
912GNUNET_TESTING_cmd_send_peer_ready (const char *label,
913 TESTING_CMD_HELPER_write_cb write_message);
914
915struct GNUNET_TESTING_Command
916GNUNET_TESTING_cmd_local_test_finished (const char *label,
917 TESTING_CMD_HELPER_write_cb
918 write_message);
845#endif 919#endif
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
index 8395e2a49..151827d4b 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -37,15 +37,16 @@ extern "C"
37#endif 37#endif
38 38
39typedef void 39typedef void
40(*TESTBED_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t 40(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t
41 msg_length); 41 msg_length);
42 42
43typedef void 43typedef void
44(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTBED_CMD_HELPER_write_cb 44(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb
45 write_message, char *router_ip, 45 write_message, char *router_ip,
46 char *node_ip, 46 char *node_ip,
47 char *n, 47 char *n,
48 char *m); 48 char *m,
49 char *local_m);
49 50
50typedef void 51typedef void
51(*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) (); 52(*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) ();
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index 3acd4cb9b..cc4f3a01e 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -58,7 +58,8 @@ extern "C"
58 * THIS release. Otherwise, you are violating the Affero GPL if you make 58 * THIS release. Otherwise, you are violating the Affero GPL if you make
59 * this service available to anyone but yourself. 59 * this service available to anyone but yourself.
60 */ 60 */
61#define GNUNET_AGPL_URL "https://gnunet.org/git/gnunet.git#" PACKAGE_VERSION 61#define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \
62 PACKAGE_VERSION
62 63
63 64
64#include "gnunet_crypto_lib.h" 65#include "gnunet_crypto_lib.h"
diff --git a/src/include/platform.h b/src/include/platform.h
index e641b38eb..e44f9f51a 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -22,7 +22,7 @@
22 * @author Nils Durner 22 * @author Nils Durner
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * 24 *
25 * @file 25 * @file gnunet/src/include/platform.h
26 * Platform specific includes and defines. 26 * Platform specific includes and defines.
27 * 27 *
28 * This file should never be included by installed 28 * This file should never be included by installed
@@ -170,18 +170,12 @@
170#include "compat.h" 170#include "compat.h"
171 171
172#include <locale.h> 172#include <locale.h>
173#ifndef FRAMEWORK_BUILD
174#include "gettext.h" 173#include "gettext.h"
175/** 174/**
176 * GNU gettext support macro. 175 * GNU gettext support macro.
177 */ 176 */
178#define _(String) dgettext (PACKAGE, String) 177#define _(String) dgettext (PACKAGE, String)
179#define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor" 178#define LIBEXTRACTOR_GETTEXT_DOMAIN "libextractor"
180#else
181#include "libintlemu.h"
182#define _(String) dgettext ("org.gnunet.gnunet", String)
183#define LIBEXTRACTOR_GETTEXT_DOMAIN "org.gnunet.libextractor"
184#endif
185 179
186#include <sys/mman.h> 180#include <sys/mman.h>
187 181
@@ -252,6 +246,32 @@ atoll (const char *nptr);
252#define GNUNET_THREAD_LOCAL 246#define GNUNET_THREAD_LOCAL
253#endif 247#endif
254 248
249
250/* LSB-style exit status codes */
251#ifndef EXIT_INVALIDARGUMENT
252#define EXIT_INVALIDARGUMENT 2
253#endif
254
255#ifndef EXIT_NOTIMPLEMENTED
256#define EXIT_NOTIMPLEMENTED 3
257#endif
258
259#ifndef EXIT_NOPERMISSION
260#define EXIT_NOPERMISSION 4
261#endif
262
263#ifndef EXIT_NOTINSTALLED
264#define EXIT_NOTINSTALLED 5
265#endif
266
267#ifndef EXIT_NOTCONFIGURED
268#define EXIT_NOTCONFIGURED 6
269#endif
270
271#ifndef EXIT_NOTRUNNING
272#define EXIT_NOTRUNNING 7
273#endif
274
255/** 275/**
256 * clang et al do not have such an attribute 276 * clang et al do not have such an attribute
257 */ 277 */