diff options
author | t3sserakt <t3ss@posteo.de> | 2022-12-07 12:47:41 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2022-12-07 12:47:41 +0100 |
commit | c3793434556c714ee34679ecf6d30de13e0d8758 (patch) | |
tree | 548c953ecf6b9e8ba8511830a6a1ddbd9afe8e46 /src/include | |
parent | 34e1c58cb39a649c9a4c551681cedf19807b85f0 (diff) | |
parent | 6bebc94d2c7b6eac69b84fde39142d008a643d8d (diff) | |
download | gnunet-c3793434556c714ee34679ecf6d30de13e0d8758.tar.gz gnunet-c3793434556c714ee34679ecf6d30de13e0d8758.zip |
Merge branch 'master' of ssh://git.gnunet.org/gnunet
Diffstat (limited to 'src/include')
120 files changed, 1012 insertions, 628 deletions
diff --git a/src/include/.gitignore b/src/include/.gitignore index 866878f87..b25882925 100644 --- a/src/include/.gitignore +++ b/src/include/.gitignore | |||
@@ -1,3 +1,6 @@ | |||
1 | gnunet_error_codes.h | 1 | gnunet_error_codes.h |
2 | gnu_name_system_record_flags.h | ||
2 | gnu_name_system_record_types.h | 3 | gnu_name_system_record_types.h |
3 | gnunet_signatures.h | 4 | gnunet_signatures.h |
5 | !gnunet_config.h.in | ||
6 | gnunet_config.h | ||
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 0f091b615..82a81077e 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -4,13 +4,15 @@ SUBDIRS = . | |||
4 | gnunetincludedir = $(includedir)/gnunet | 4 | gnunetincludedir = $(includedir)/gnunet |
5 | 5 | ||
6 | EXTRA_DIST = \ | 6 | EXTRA_DIST = \ |
7 | platform.h \ | ||
7 | gauger.h \ | 8 | gauger.h \ |
8 | block_fs.h \ | 9 | block_fs.h \ |
9 | block_dns.h \ | 10 | block_dns.h \ |
10 | block_regex.h | 11 | block_regex.h |
11 | 12 | ||
12 | gnunetinclude_HEADERS = \ | 13 | gnunetinclude_HEADERS = \ |
13 | platform.h gettext.h \ | 14 | gnunet_config.h \ |
15 | gettext.h \ | ||
14 | compat.h \ | 16 | compat.h \ |
15 | gnunet_abd_service.h \ | 17 | gnunet_abd_service.h \ |
16 | gnunet_applications.h \ | 18 | gnunet_applications.h \ |
@@ -57,6 +59,7 @@ gnunetinclude_HEADERS = \ | |||
57 | gnunet_gnsrecord_lib.h \ | 59 | gnunet_gnsrecord_lib.h \ |
58 | gnunet_gnsrecord_json_lib.h \ | 60 | gnunet_gnsrecord_json_lib.h \ |
59 | gnunet_gnsrecord_plugin.h \ | 61 | gnunet_gnsrecord_plugin.h \ |
62 | gnu_name_system_record_flags.h \ | ||
60 | gnu_name_system_record_types.h \ | 63 | gnu_name_system_record_types.h \ |
61 | gnunet_hello_lib.h \ | 64 | gnunet_hello_lib.h \ |
62 | gnunet_hello_uri_lib.h \ | 65 | gnunet_hello_uri_lib.h \ |
@@ -74,6 +77,7 @@ gnunetinclude_HEADERS = \ | |||
74 | gnunet_mst_lib.h \ | 77 | gnunet_mst_lib.h \ |
75 | gnunet_mq_lib.h \ | 78 | gnunet_mq_lib.h \ |
76 | gnunet_my_lib.h \ | 79 | gnunet_my_lib.h \ |
80 | gnunet_mysql_compat.h \ | ||
77 | gnunet_mysql_lib.h \ | 81 | gnunet_mysql_lib.h \ |
78 | gnunet_namecache_plugin.h \ | 82 | gnunet_namecache_plugin.h \ |
79 | gnunet_namecache_service.h \ | 83 | gnunet_namecache_service.h \ |
diff --git a/src/include/block_dns.h b/src/include/block_dns.h index 2c573fb20..4ac6d0250 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #ifndef BLOCK_DNS_H | 33 | #ifndef BLOCK_DNS_H |
34 | #define BLOCK_DNS_H | 34 | #define BLOCK_DNS_H |
35 | 35 | ||
36 | |||
36 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
37 | 38 | ||
38 | GNUNET_NETWORK_STRUCT_BEGIN | 39 | GNUNET_NETWORK_STRUCT_BEGIN |
diff --git a/src/include/block_fs.h b/src/include/block_fs.h index f05bb4a29..b64a83f39 100644 --- a/src/include/block_fs.h +++ b/src/include/block_fs.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef BLOCK_FS_H | 34 | #ifndef BLOCK_FS_H |
35 | #define BLOCK_FS_H | 35 | #define BLOCK_FS_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_fs_service.h" | 39 | #include "gnunet_fs_service.h" |
39 | 40 | ||
diff --git a/src/include/block_regex.h b/src/include/block_regex.h index cc78f2c32..fea19e335 100644 --- a/src/include/block_regex.h +++ b/src/include/block_regex.h | |||
@@ -36,6 +36,7 @@ extern "C" | |||
36 | #endif | 36 | #endif |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | |||
39 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
40 | #include <stdint.h> | 41 | #include <stdint.h> |
41 | 42 | ||
diff --git a/src/include/gauger.h b/src/include/gauger.h index 716ce9cb1..f811b335c 100644 --- a/src/include/gauger.h +++ b/src/include/gauger.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #ifndef __GAUGER_H__ | 11 | #ifndef __GAUGER_H__ |
12 | #define __GAUGER_H__ | 12 | #define __GAUGER_H__ |
13 | 13 | ||
14 | |||
14 | #include <unistd.h> | 15 | #include <unistd.h> |
15 | #include <stdio.h> | 16 | #include <stdio.h> |
16 | #include <sys/wait.h> | 17 | #include <sys/wait.h> |
diff --git a/src/include/gettext.h b/src/include/gettext.h index 458512657..6e98f197a 100644 --- a/src/include/gettext.h +++ b/src/include/gettext.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #if ENABLE_NLS | 23 | #if ENABLE_NLS |
24 | 24 | ||
25 | /* Get declarations of GNU message catalog functions. */ | 25 | /* Get declarations of GNU message catalog functions. */ |
26 | |||
26 | #include <libintl.h> | 27 | #include <libintl.h> |
27 | 28 | ||
28 | #else | 29 | #else |
diff --git a/src/include/gnunet_abd_service.h b/src/include/gnunet_abd_service.h index a52ed29ff..75c1757ab 100644 --- a/src/include/gnunet_abd_service.h +++ b/src/include/gnunet_abd_service.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #ifndef GNUNET_ABD_SERVICE_H | 35 | #ifndef GNUNET_ABD_SERVICE_H |
36 | #define GNUNET_ABD_SERVICE_H | 36 | #define GNUNET_ABD_SERVICE_H |
37 | 37 | ||
38 | |||
38 | #include "gnunet_util_lib.h" | 39 | #include "gnunet_util_lib.h" |
39 | #include "gnunet_gns_service.h" | 40 | #include "gnunet_gns_service.h" |
40 | #include "gnunet_identity_service.h" | 41 | #include "gnunet_identity_service.h" |
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index 9615f8c9d..639e723c5 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
47 | 48 | ||
48 | /** | 49 | /** |
diff --git a/src/include/gnunet_ats_application_service.h b/src/include/gnunet_ats_application_service.h index 4d976572e..da7fd4b52 100644 --- a/src/include/gnunet_ats_application_service.h +++ b/src/include/gnunet_ats_application_service.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef GNUNET_ATS_APPLICATION_SERVICE_H | 37 | #ifndef GNUNET_ATS_APPLICATION_SERVICE_H |
38 | #define GNUNET_ATS_APPLICATION_SERVICE_H | 38 | #define GNUNET_ATS_APPLICATION_SERVICE_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_constants.h" | 41 | #include "gnunet_constants.h" |
41 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
42 | 43 | ||
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h index 59d09f690..206f2dd52 100644 --- a/src/include/gnunet_ats_plugin.h +++ b/src/include/gnunet_ats_plugin.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef PLUGIN_ATS_H | 40 | #ifndef PLUGIN_ATS_H |
41 | #define PLUGIN_ATS_H | 41 | #define PLUGIN_ATS_H |
42 | 42 | ||
43 | |||
43 | #include "gnunet_ats_service.h" | 44 | #include "gnunet_ats_service.h" |
44 | #include "gnunet_statistics_service.h" | 45 | #include "gnunet_statistics_service.h" |
45 | 46 | ||
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 321e621d2..ce149875a 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef GNUNET_ATS_SERVICE_H | 37 | #ifndef GNUNET_ATS_SERVICE_H |
38 | #define GNUNET_ATS_SERVICE_H | 38 | #define GNUNET_ATS_SERVICE_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_constants.h" | 41 | #include "gnunet_constants.h" |
41 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
42 | #include "gnunet_hello_lib.h" | 43 | #include "gnunet_hello_lib.h" |
diff --git a/src/include/gnunet_ats_transport_service.h b/src/include/gnunet_ats_transport_service.h index fd821baef..b6c7b15ae 100644 --- a/src/include/gnunet_ats_transport_service.h +++ b/src/include/gnunet_ats_transport_service.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_ATS_TRANSPORT_SERVICE_H | 34 | #ifndef GNUNET_ATS_TRANSPORT_SERVICE_H |
35 | #define GNUNET_ATS_TRANSPORT_SERVICE_H | 35 | #define GNUNET_ATS_TRANSPORT_SERVICE_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_constants.h" | 38 | #include "gnunet_constants.h" |
38 | #include "gnunet_util_lib.h" | 39 | #include "gnunet_util_lib.h" |
39 | #include "gnunet_nt_lib.h" | 40 | #include "gnunet_nt_lib.h" |
diff --git a/src/include/gnunet_bandwidth_lib.h b/src/include/gnunet_bandwidth_lib.h index 9f173a691..7c854aab5 100644 --- a/src/include/gnunet_bandwidth_lib.h +++ b/src/include/gnunet_bandwidth_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -33,6 +37,10 @@ | |||
33 | * @{ | 37 | * @{ |
34 | */ | 38 | */ |
35 | 39 | ||
40 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
41 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
42 | #endif | ||
43 | |||
36 | #ifndef GNUNET_BANDWIDTH_LIB_H | 44 | #ifndef GNUNET_BANDWIDTH_LIB_H |
37 | #define GNUNET_BANDWIDTH_LIB_H | 45 | #define GNUNET_BANDWIDTH_LIB_H |
38 | 46 | ||
@@ -43,7 +51,7 @@ extern "C" { | |||
43 | #endif | 51 | #endif |
44 | #endif | 52 | #endif |
45 | 53 | ||
46 | #include "gnunet_common.h" | 54 | |
47 | #include "gnunet_time_lib.h" | 55 | #include "gnunet_time_lib.h" |
48 | 56 | ||
49 | GNUNET_NETWORK_STRUCT_BEGIN | 57 | GNUNET_NETWORK_STRUCT_BEGIN |
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h index 5eefabff2..48a1a512d 100644 --- a/src/include/gnunet_bio_lib.h +++ b/src/include/gnunet_bio_lib.h | |||
@@ -33,9 +33,14 @@ | |||
33 | * @{ | 33 | * @{ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
37 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
38 | #endif | ||
39 | |||
36 | #ifndef GNUNET_BIO_LIB_H | 40 | #ifndef GNUNET_BIO_LIB_H |
37 | #define GNUNET_BIO_LIB_H | 41 | #define GNUNET_BIO_LIB_H |
38 | 42 | ||
43 | |||
39 | #include "gnunet_container_lib.h" | 44 | #include "gnunet_container_lib.h" |
40 | 45 | ||
41 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
@@ -86,6 +91,15 @@ GNUNET_BIO_read_open_buffer (void *buffer, size_t size); | |||
86 | int | 91 | int |
87 | GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg); | 92 | GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg); |
88 | 93 | ||
94 | /** | ||
95 | * Set read error to handle | ||
96 | * | ||
97 | * @param h the handle | ||
98 | * @param emsg the message | ||
99 | */ | ||
100 | void | ||
101 | GNUNET_BIO_read_set_error (struct GNUNET_BIO_ReadHandle *h, const char* emsg); | ||
102 | |||
89 | 103 | ||
90 | /** | 104 | /** |
91 | * Read some contents into a buffer. | 105 | * Read some contents into a buffer. |
@@ -120,19 +134,6 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
120 | size_t max_length); | 134 | size_t max_length); |
121 | 135 | ||
122 | 136 | ||
123 | /** | ||
124 | * Read a metadata container. | ||
125 | * | ||
126 | * @param h handle to an open file | ||
127 | * @param what describes what is being read (for error message creation) | ||
128 | * @param result the buffer to store a pointer to the (allocated) metadata | ||
129 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
130 | */ | ||
131 | int | ||
132 | GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | ||
133 | const char *what, | ||
134 | struct GNUNET_CONTAINER_MetaData **result); | ||
135 | |||
136 | 137 | ||
137 | /** | 138 | /** |
138 | * Read a float. | 139 | * Read a float. |
@@ -289,19 +290,6 @@ GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | |||
289 | const char *s); | 290 | const char *s); |
290 | 291 | ||
291 | 292 | ||
292 | /** | ||
293 | * Write a metadata container. | ||
294 | * | ||
295 | * @param h the IO handle to write to | ||
296 | * @param what what is being written (for error message creation) | ||
297 | * @param m metadata to write | ||
298 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
299 | */ | ||
300 | int | ||
301 | GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | ||
302 | const char *what, | ||
303 | const struct GNUNET_CONTAINER_MetaData *m); | ||
304 | |||
305 | 293 | ||
306 | /** | 294 | /** |
307 | * Write a float. | 295 | * Write a float. |
@@ -448,17 +436,6 @@ GNUNET_BIO_read_spec_string (const char *what, | |||
448 | size_t max_length); | 436 | size_t max_length); |
449 | 437 | ||
450 | 438 | ||
451 | /** | ||
452 | * Create the specification to read a metadata container. | ||
453 | * | ||
454 | * @param what describes what is being read (for error message creation) | ||
455 | * @param result the buffer to store a pointer to the (allocated) metadata | ||
456 | * @return the read spec | ||
457 | */ | ||
458 | struct GNUNET_BIO_ReadSpec | ||
459 | GNUNET_BIO_read_spec_meta_data (const char *what, | ||
460 | struct GNUNET_CONTAINER_MetaData **result); | ||
461 | |||
462 | 439 | ||
463 | /** | 440 | /** |
464 | * Create the specification to read an (u)int32_t. | 441 | * Create the specification to read an (u)int32_t. |
@@ -605,18 +582,6 @@ GNUNET_BIO_write_spec_string (const char *what, | |||
605 | 582 | ||
606 | 583 | ||
607 | /** | 584 | /** |
608 | * Create the specification to write a metadata container. | ||
609 | * | ||
610 | * @param what what is being written (for error message creation) | ||
611 | * @param m metadata to write | ||
612 | * @return the write spec | ||
613 | */ | ||
614 | struct GNUNET_BIO_WriteSpec | ||
615 | GNUNET_BIO_write_spec_meta_data (const char *what, | ||
616 | const struct GNUNET_CONTAINER_MetaData *m); | ||
617 | |||
618 | |||
619 | /** | ||
620 | * Create the specification to write an (u)int32_t. | 585 | * Create the specification to write an (u)int32_t. |
621 | * | 586 | * |
622 | * @param what describes what is being written (for error message creation) | 587 | * @param what describes what is being written (for error message creation) |
diff --git a/src/include/gnunet_block_group_lib.h b/src/include/gnunet_block_group_lib.h index 53827f5f4..b1f59899e 100644 --- a/src/include/gnunet_block_group_lib.h +++ b/src/include/gnunet_block_group_lib.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #ifndef GNUNET_BLOCK_GROUP_LIB_H | 31 | #ifndef GNUNET_BLOCK_GROUP_LIB_H |
32 | #define GNUNET_BLOCK_GROUP_LIB_H | 32 | #define GNUNET_BLOCK_GROUP_LIB_H |
33 | 33 | ||
34 | |||
34 | #include "gnunet_util_lib.h" | 35 | #include "gnunet_util_lib.h" |
35 | #include "gnunet_block_lib.h" | 36 | #include "gnunet_block_lib.h" |
36 | 37 | ||
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h index 6a6de712b..fdccbab78 100644 --- a/src/include/gnunet_block_lib.h +++ b/src/include/gnunet_block_lib.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_BLOCK_LIB_H | 34 | #ifndef GNUNET_BLOCK_LIB_H |
35 | #define GNUNET_BLOCK_LIB_H | 35 | #define GNUNET_BLOCK_LIB_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_dht_block_types.h" | 39 | #include "gnunet_dht_block_types.h" |
39 | 40 | ||
diff --git a/src/include/gnunet_block_plugin.h b/src/include/gnunet_block_plugin.h index 7cd744ac4..16e93c780 100644 --- a/src/include/gnunet_block_plugin.h +++ b/src/include/gnunet_block_plugin.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #ifndef PLUGIN_BLOCK_H | 38 | #ifndef PLUGIN_BLOCK_H |
39 | #define PLUGIN_BLOCK_H | 39 | #define PLUGIN_BLOCK_H |
40 | 40 | ||
41 | |||
41 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
42 | #include "gnunet_block_lib.h" | 43 | #include "gnunet_block_lib.h" |
43 | 44 | ||
diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h index 174d2d010..e65981206 100644 --- a/src/include/gnunet_buffer_lib.h +++ b/src/include/gnunet_buffer_lib.h | |||
@@ -28,6 +28,10 @@ | |||
28 | * @author Florian Dold | 28 | * @author Florian Dold |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
32 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
33 | #endif | ||
34 | |||
31 | #ifndef GNUNET_BUFFER_LIB_H | 35 | #ifndef GNUNET_BUFFER_LIB_H |
32 | #define GNUNET_BUFFER_LIB_H | 36 | #define GNUNET_BUFFER_LIB_H |
33 | 37 | ||
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index 45c70df3e..acc7bb330 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -45,6 +45,7 @@ extern "C" { | |||
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | |||
48 | #include "gnunet_util_lib.h" | 49 | #include "gnunet_util_lib.h" |
49 | #include "gnunet_transport_service.h" | 50 | #include "gnunet_transport_service.h" |
50 | 51 | ||
diff --git a/src/include/gnunet_child_management_lib.h b/src/include/gnunet_child_management_lib.h index e7f1271ee..d8f63b60d 100644 --- a/src/include/gnunet_child_management_lib.h +++ b/src/include/gnunet_child_management_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index 321810eb4..ab4c7d088 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -39,6 +39,10 @@ | |||
39 | * @{ | 39 | * @{ |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
43 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
44 | #endif | ||
45 | |||
42 | #ifndef GNUNET_CLIENT_LIB_H | 46 | #ifndef GNUNET_CLIENT_LIB_H |
43 | #define GNUNET_CLIENT_LIB_H | 47 | #define GNUNET_CLIENT_LIB_H |
44 | 48 | ||
@@ -50,6 +54,7 @@ extern "C" | |||
50 | #endif | 54 | #endif |
51 | #endif | 55 | #endif |
52 | 56 | ||
57 | |||
53 | #include "gnunet_mq_lib.h" | 58 | #include "gnunet_mq_lib.h" |
54 | 59 | ||
55 | 60 | ||
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 8c58fd6e3..07a847814 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -40,28 +40,37 @@ | |||
40 | #ifndef GNUNET_COMMON_H | 40 | #ifndef GNUNET_COMMON_H |
41 | #define GNUNET_COMMON_H | 41 | #define GNUNET_COMMON_H |
42 | 42 | ||
43 | #include "gnunet_config.h" | ||
44 | |||
43 | #include <stdlib.h> | 45 | #include <stdlib.h> |
44 | #if HAVE_SYS_SOCKET_H | ||
45 | #include <sys/socket.h> | 46 | #include <sys/socket.h> |
46 | #endif | 47 | #include <sys/un.h> |
47 | #if HAVE_NETINET_IN_H | ||
48 | #include <netinet/in.h> | 48 | #include <netinet/in.h> |
49 | #endif | 49 | #include <arpa/inet.h> |
50 | #ifdef HAVE_STDINT_H | ||
51 | #include <stdint.h> | 50 | #include <stdint.h> |
52 | #endif | ||
53 | #ifdef HAVE_STDARG_H | ||
54 | #include <stdarg.h> | 51 | #include <stdarg.h> |
55 | #endif | ||
56 | #ifdef HAVE_SYS_TYPES_H | ||
57 | #include <sys/types.h> | 52 | #include <sys/types.h> |
58 | #endif | ||
59 | #ifdef HAVE_SYS_SOCKET_H | ||
60 | #include <sys/socket.h> | ||
61 | #endif | ||
62 | 53 | ||
54 | #if defined(__FreeBSD__) | ||
55 | |||
56 | #include <sys/endian.h> | ||
57 | #define bswap_32(x) bswap32(x) | ||
58 | #define bswap_64(x) bswap64(x) | ||
59 | |||
60 | #elif defined(__OpenBSD__) | ||
61 | |||
62 | #define bswap_32(x) swap32(x) | ||
63 | #define bswap_64(x) swap64(x) | ||
64 | |||
65 | #elif defined(__NetBSD__) | ||
66 | |||
67 | #include <machine/bswap.h> | ||
68 | #if defined(__BSWAP_RENAME) && !defined(__bswap_32) | ||
69 | #define bswap_32(x) bswap32(x) | ||
70 | #define bswap_64(x) bswap64(x) | ||
71 | #endif | ||
63 | 72 | ||
64 | #ifdef HAVE_BYTESWAP_H | 73 | #elif defined(__linux__) || defined(GNU) |
65 | #include <byteswap.h> | 74 | #include <byteswap.h> |
66 | #endif | 75 | #endif |
67 | 76 | ||
@@ -155,7 +164,7 @@ enum GNUNET_GenericReturnValue | |||
155 | */ | 164 | */ |
156 | 165 | ||
157 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 166 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
158 | #ifdef HAVE_BYTESWAP_H | 167 | #if defined(bswap_16) || defined(bswap_32) || defined(bswap_64) |
159 | #define BYTE_SWAP_16(x) bswap_16 (x) | 168 | #define BYTE_SWAP_16(x) bswap_16 (x) |
160 | #define BYTE_SWAP_32(x) bswap_32 (x) | 169 | #define BYTE_SWAP_32(x) bswap_32 (x) |
161 | #define BYTE_SWAP_64(x) bswap_64 (x) | 170 | #define BYTE_SWAP_64(x) bswap_64 (x) |
@@ -984,7 +993,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
984 | } while (0) | 993 | } while (0) |
985 | 994 | ||
986 | 995 | ||
987 | #if HAVE_STATIC_ASSERT | 996 | #ifdef _Static_assert |
988 | /** | 997 | /** |
989 | * Assertion to be checked (if supported by C compiler) at | 998 | * Assertion to be checked (if supported by C compiler) at |
990 | * compile time, otherwise checked at runtime and resulting | 999 | * compile time, otherwise checked at runtime and resulting |
diff --git a/src/include/gnunet_config.h.in b/src/include/gnunet_config.h.in new file mode 100644 index 000000000..5dff759ae --- /dev/null +++ b/src/include/gnunet_config.h.in | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2022 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 | #ifndef GNUNET_CONFIG_H | ||
22 | #define GNUNET_CONFIG_H | ||
23 | |||
24 | /** | ||
25 | * @author Martin Schanzenbach | ||
26 | * | ||
27 | * @file | ||
28 | * Convenience header including public (!) information on the | ||
29 | * installed GNUnet configuration. | ||
30 | * | ||
31 | */ | ||
32 | |||
33 | /* The version of GNUnet */ | ||
34 | #define GNUNET_VERSION "@gnunet_version@" | ||
35 | |||
36 | /* Major version */ | ||
37 | #define GNUNET_MAJOR_VERSION @gnunet_major_version@ | ||
38 | |||
39 | /* Micro version */ | ||
40 | #define GNUNET_MINOR_VERSION @gnunet_minor_version@ | ||
41 | |||
42 | /* Mico version */ | ||
43 | #define GNUNET_MICRO_VERSION @gnunet_micro_version@ | ||
44 | |||
45 | /* Set to 1 is this is an experimental build */ | ||
46 | #define GNUNET_EXPERIMENTAL @enable_experimental@ | ||
47 | |||
48 | /* Set to 1 if GnuTLS has DANE support */ | ||
49 | #define GNUNET_CURL_GNUTLS @curl_gnutls@ | ||
50 | |||
51 | /** | ||
52 | * Set to 1 if file-sharing meta data parsing is built with | ||
53 | * libextractor, which means that callers to the API must use also use | ||
54 | * libextractor. | ||
55 | */ | ||
56 | #define GNUNET_FS_EXTRACTOR_ENABLED @extractor@ | ||
57 | |||
58 | #endif | ||
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 2d26f3c05..3b9be5849 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #ifndef GNUNET_CONFIGURATION_LIB_H | 35 | #ifndef GNUNET_CONFIGURATION_LIB_H |
36 | #define GNUNET_CONFIGURATION_LIB_H | 36 | #define GNUNET_CONFIGURATION_LIB_H |
37 | 37 | ||
38 | |||
38 | #include "gnunet_time_lib.h" | 39 | #include "gnunet_time_lib.h" |
39 | 40 | ||
40 | #ifdef __cplusplus | 41 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h index 1d2ec63cd..47a928d9c 100644 --- a/src/include/gnunet_consensus_service.h +++ b/src/include/gnunet_consensus_service.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_common.h" | 47 | #include "gnunet_common.h" |
47 | #include "gnunet_time_lib.h" | 48 | #include "gnunet_time_lib.h" |
48 | #include "gnunet_configuration_lib.h" | 49 | #include "gnunet_configuration_lib.h" |
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index b31a95fac..1d39f813b 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -28,11 +28,11 @@ | |||
28 | * | 28 | * |
29 | * @file | 29 | * @file |
30 | * Container classes for GNUnet | 30 | * Container classes for GNUnet |
31 | * | 31 | * |
32 | * @addtogroup container | 32 | * @addtogroup container |
33 | * Common data structures in GNUnet programs | 33 | * Common data structures in GNUnet programs |
34 | * @{ | 34 | * @{ |
35 | * | 35 | * |
36 | * @defgroup hashmap MultiHashMap | 36 | * @defgroup hashmap MultiHashMap |
37 | * Hash map with multiple values per key. | 37 | * Hash map with multiple values per key. |
38 | * | 38 | * |
@@ -48,16 +48,19 @@ | |||
48 | * | 48 | * |
49 | * @see [Documentation](https://gnunet.org/mdll-api) | 49 | * @see [Documentation](https://gnunet.org/mdll-api) |
50 | * | 50 | * |
51 | * @defgroup metadata Metadata | 51 | * |
52 | * GNU libextractor key-value pairs | ||
53 | * | ||
54 | * @} | 52 | * @} |
55 | */ | 53 | */ |
56 | 54 | ||
55 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
56 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
57 | #endif | ||
58 | |||
57 | #ifndef GNUNET_CONTAINER_LIB_H | 59 | #ifndef GNUNET_CONTAINER_LIB_H |
58 | #define GNUNET_CONTAINER_LIB_H | 60 | #define GNUNET_CONTAINER_LIB_H |
59 | 61 | ||
60 | /* add error and config prototypes */ | 62 | /* add error and config prototypes */ |
63 | |||
61 | #include "gnunet_crypto_lib.h" | 64 | #include "gnunet_crypto_lib.h" |
62 | 65 | ||
63 | 66 | ||
@@ -97,114 +100,6 @@ char * | |||
97 | GNUNET_decompress (const char *input, size_t input_size, size_t output_size); | 100 | GNUNET_decompress (const char *input, size_t input_size, size_t output_size); |
98 | 101 | ||
99 | 102 | ||
100 | #if HAVE_EXTRACTOR_H | ||
101 | |||
102 | #include <extractor.h> | ||
103 | |||
104 | #else | ||
105 | |||
106 | /* definitions from extractor.h we need for the build */ | ||
107 | |||
108 | /** | ||
109 | * Enumeration defining various sources of keywords. See also | ||
110 | * http://dublincore.org/documents/1998/09/dces/ | ||
111 | */ | ||
112 | enum EXTRACTOR_MetaType | ||
113 | { | ||
114 | EXTRACTOR_METATYPE_RESERVED = 0, | ||
115 | EXTRACTOR_METATYPE_MIMETYPE = 1, | ||
116 | EXTRACTOR_METATYPE_FILENAME = 2, | ||
117 | EXTRACTOR_METATYPE_COMMENT = 3, | ||
118 | EXTRACTOR_METATYPE_TITLE = 4, | ||
119 | EXTRACTOR_METATYPE_BOOK_TITLE = 5, | ||
120 | EXTRACTOR_METATYPE_JOURNAL_NAME = 8, | ||
121 | EXTRACTOR_METATYPE_AUTHOR_NAME = 13, | ||
122 | EXTRACTOR_METATYPE_PUBLICATION_DATE = 24, | ||
123 | EXTRACTOR_METATYPE_URL = 29, | ||
124 | EXTRACTOR_METATYPE_URI = 30, | ||
125 | EXTRACTOR_METATYPE_ISRC = 31, | ||
126 | EXTRACTOR_METATYPE_UNKNOWN = 45, | ||
127 | EXTRACTOR_METATYPE_DESCRIPTION = 46, | ||
128 | EXTRACTOR_METATYPE_KEYWORDS = 49, | ||
129 | EXTRACTOR_METATYPE_SUBJECT = 52, | ||
130 | EXTRACTOR_METATYPE_PACKAGE_NAME = 69, | ||
131 | EXTRACTOR_METATYPE_THUMBNAIL = 114, | ||
132 | EXTRACTOR_METATYPE_ALBUM = 129, | ||
133 | EXTRACTOR_METATYPE_ARTIST = 130, | ||
134 | EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162, | ||
135 | EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174, | ||
136 | EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180, | ||
137 | }; | ||
138 | |||
139 | /** | ||
140 | * Format in which the extracted meta data is presented. | ||
141 | */ | ||
142 | enum EXTRACTOR_MetaFormat | ||
143 | { | ||
144 | /** | ||
145 | * Format is unknown. | ||
146 | */ | ||
147 | EXTRACTOR_METAFORMAT_UNKNOWN = 0, | ||
148 | |||
149 | /** | ||
150 | * 0-terminated, UTF-8 encoded string. "data_len" | ||
151 | * is strlen(data)+1. | ||
152 | */ | ||
153 | EXTRACTOR_METAFORMAT_UTF8 = 1, | ||
154 | |||
155 | /** | ||
156 | * Some kind of binary format, see given Mime type. | ||
157 | */ | ||
158 | EXTRACTOR_METAFORMAT_BINARY = 2, | ||
159 | |||
160 | /** | ||
161 | * 0-terminated string. The specific encoding is unknown. | ||
162 | * "data_len" is strlen (data)+1. | ||
163 | */ | ||
164 | EXTRACTOR_METAFORMAT_C_STRING = 3 | ||
165 | }; | ||
166 | |||
167 | |||
168 | /** | ||
169 | * Type of a function that libextractor calls for each | ||
170 | * meta data item found. | ||
171 | * | ||
172 | * @param cls closure (user-defined) | ||
173 | * @param plugin_name name of the plugin that produced this value; | ||
174 | * special values can be used (e.g. '<zlib>' for zlib being | ||
175 | * used in the main libextractor library and yielding | ||
176 | * meta data). | ||
177 | * @param type libextractor-type describing the meta data | ||
178 | * @param format basic format information about @a data | ||
179 | * @param data_mime_type mime-type of @a data (not of the original file); | ||
180 | * can be NULL (if mime-type is not known) | ||
181 | * @param data actual meta-data found | ||
182 | * @param data_len number of bytes in @a data | ||
183 | * @return 0 to continue extracting, 1 to abort | ||
184 | */ | ||
185 | typedef int (*EXTRACTOR_MetaDataProcessor) (void *cls, | ||
186 | const char *plugin_name, | ||
187 | enum EXTRACTOR_MetaType type, | ||
188 | enum EXTRACTOR_MetaFormat format, | ||
189 | const char *data_mime_type, | ||
190 | const char *data, | ||
191 | size_t data_len); | ||
192 | |||
193 | #endif | ||
194 | |||
195 | #ifndef EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME | ||
196 | /* hack for LE < 0.6.3 */ | ||
197 | #define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180 | ||
198 | #endif | ||
199 | |||
200 | #ifdef __cplusplus | ||
201 | extern "C" { | ||
202 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
203 | } | ||
204 | #endif | ||
205 | #endif | ||
206 | |||
207 | |||
208 | /* ******************* bloomfilter ***************** */ | 103 | /* ******************* bloomfilter ***************** */ |
209 | 104 | ||
210 | /** | 105 | /** |
@@ -430,285 +325,6 @@ GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf, | |||
430 | unsigned int k); | 325 | unsigned int k); |
431 | 326 | ||
432 | 327 | ||
433 | /* ****************** metadata ******************* */ | ||
434 | |||
435 | /** | ||
436 | * @ingroup metadata | ||
437 | * Meta data to associate with a file, directory or namespace. | ||
438 | */ | ||
439 | struct GNUNET_CONTAINER_MetaData; | ||
440 | |||
441 | |||
442 | /** | ||
443 | * @ingroup metadata | ||
444 | * Create a fresh meta data container. | ||
445 | * | ||
446 | * @return empty meta-data container | ||
447 | */ | ||
448 | struct GNUNET_CONTAINER_MetaData * | ||
449 | GNUNET_CONTAINER_meta_data_create (void); | ||
450 | |||
451 | |||
452 | /** | ||
453 | * @ingroup metadata | ||
454 | * Duplicate a MetaData token. | ||
455 | * | ||
456 | * @param md what to duplicate | ||
457 | * @return duplicate meta-data container | ||
458 | */ | ||
459 | struct GNUNET_CONTAINER_MetaData * | ||
460 | GNUNET_CONTAINER_meta_data_duplicate ( | ||
461 | const struct GNUNET_CONTAINER_MetaData *md); | ||
462 | |||
463 | |||
464 | /** | ||
465 | * @ingroup metadata | ||
466 | * Free meta data. | ||
467 | * | ||
468 | * @param md what to free | ||
469 | */ | ||
470 | void | ||
471 | GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); | ||
472 | |||
473 | |||
474 | /** | ||
475 | * @ingroup metadata | ||
476 | * Test if two MDs are equal. We consider them equal if | ||
477 | * the meta types, formats and content match (we do not | ||
478 | * include the mime types and plugins names in this | ||
479 | * consideration). | ||
480 | * | ||
481 | * @param md1 first value to check | ||
482 | * @param md2 other value to check | ||
483 | * @return #GNUNET_YES if they are equal | ||
484 | */ | ||
485 | int | ||
486 | GNUNET_CONTAINER_meta_data_test_equal ( | ||
487 | const struct GNUNET_CONTAINER_MetaData *md1, | ||
488 | const struct GNUNET_CONTAINER_MetaData *md2); | ||
489 | |||
490 | |||
491 | /** | ||
492 | * @ingroup metadata | ||
493 | * Extend metadata. | ||
494 | * | ||
495 | * @param md metadata to extend | ||
496 | * @param plugin_name name of the plugin that produced this value; | ||
497 | * special values can be used (e.g. '<zlib>' for zlib being | ||
498 | * used in the main libextractor library and yielding | ||
499 | * meta data). | ||
500 | * @param type libextractor-type describing the meta data | ||
501 | * @param format basic format information about data | ||
502 | * @param data_mime_type mime-type of data (not of the original file); | ||
503 | * can be NULL (if mime-type is not known) | ||
504 | * @param data actual meta-data found | ||
505 | * @param data_size number of bytes in data | ||
506 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if this entry already exists | ||
507 | * data_mime_type and plugin_name are not considered for "exists" checks | ||
508 | */ | ||
509 | int | ||
510 | GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, | ||
511 | const char *plugin_name, | ||
512 | enum EXTRACTOR_MetaType type, | ||
513 | enum EXTRACTOR_MetaFormat format, | ||
514 | const char *data_mime_type, | ||
515 | const char *data, | ||
516 | size_t data_size); | ||
517 | |||
518 | |||
519 | /** | ||
520 | * @ingroup metadata | ||
521 | * Extend metadata. Merges the meta data from the second argument | ||
522 | * into the first, discarding duplicate key-value pairs. | ||
523 | * | ||
524 | * @param md metadata to extend | ||
525 | * @param in metadata to merge | ||
526 | */ | ||
527 | void | ||
528 | GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, | ||
529 | const struct GNUNET_CONTAINER_MetaData *in); | ||
530 | |||
531 | |||
532 | /** | ||
533 | * @ingroup metadata | ||
534 | * Remove an item. | ||
535 | * | ||
536 | * @param md metadata to manipulate | ||
537 | * @param type type of the item to remove | ||
538 | * @param data specific value to remove, NULL to remove all | ||
539 | * entries of the given type | ||
540 | * @param data_size number of bytes in data | ||
541 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the item does not exist in md | ||
542 | */ | ||
543 | int | ||
544 | GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | ||
545 | enum EXTRACTOR_MetaType type, | ||
546 | const char *data, | ||
547 | size_t data_size); | ||
548 | |||
549 | |||
550 | /** | ||
551 | * @ingroup metadata | ||
552 | * Remove all items in the container. | ||
553 | * | ||
554 | * @param md metadata to manipulate | ||
555 | */ | ||
556 | void | ||
557 | GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | ||
558 | |||
559 | |||
560 | /** | ||
561 | * @ingroup metadata | ||
562 | * Add the current time as the publication date | ||
563 | * to the meta-data. | ||
564 | * | ||
565 | * @param md metadata to modify | ||
566 | */ | ||
567 | void | ||
568 | GNUNET_CONTAINER_meta_data_add_publication_date ( | ||
569 | struct GNUNET_CONTAINER_MetaData *md); | ||
570 | |||
571 | |||
572 | /** | ||
573 | * @ingroup metadata | ||
574 | * Iterate over MD entries. | ||
575 | * | ||
576 | * @param md metadata to inspect | ||
577 | * @param iter function to call on each entry, return 0 to continue to iterate | ||
578 | * and 1 to abort iteration in this function (GNU libextractor API!) | ||
579 | * @param iter_cls closure for @a iter | ||
580 | * @return number of entries | ||
581 | */ | ||
582 | int | ||
583 | GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md, | ||
584 | EXTRACTOR_MetaDataProcessor iter, | ||
585 | void *iter_cls); | ||
586 | |||
587 | |||
588 | /** | ||
589 | * @ingroup metadata | ||
590 | * Get the first MD entry of the given type. Caller | ||
591 | * is responsible for freeing the return value. | ||
592 | * Also, only meta data items that are strings (0-terminated) | ||
593 | * are returned by this function. | ||
594 | * | ||
595 | * @param md metadata to inspect | ||
596 | * @param type type to look for | ||
597 | * @return NULL if no entry was found | ||
598 | */ | ||
599 | char * | ||
600 | GNUNET_CONTAINER_meta_data_get_by_type ( | ||
601 | const struct GNUNET_CONTAINER_MetaData *md, | ||
602 | enum EXTRACTOR_MetaType type); | ||
603 | |||
604 | |||
605 | /** | ||
606 | * @ingroup metadata | ||
607 | * Get the first matching MD entry of the given types. Caller is | ||
608 | * responsible for freeing the return value. Also, only meta data | ||
609 | * items that are strings (0-terminated) are returned by this | ||
610 | * function. | ||
611 | * | ||
612 | * @param md metadata to inspect | ||
613 | * @param ... -1-terminated list of types | ||
614 | * @return NULL if we do not have any such entry, | ||
615 | * otherwise client is responsible for freeing the value! | ||
616 | */ | ||
617 | char * | ||
618 | GNUNET_CONTAINER_meta_data_get_first_by_types ( | ||
619 | const struct GNUNET_CONTAINER_MetaData *md, | ||
620 | ...); | ||
621 | |||
622 | /** | ||
623 | * @ingroup metadata | ||
624 | * Get a thumbnail from the meta-data (if present). Only matches meta | ||
625 | * data with mime type "image" and binary format. | ||
626 | * | ||
627 | * @param md metadata to inspect | ||
628 | * @param thumb will be set to the thumbnail data. Must be | ||
629 | * freed by the caller! | ||
630 | * @return number of bytes in thumbnail, 0 if not available | ||
631 | */ | ||
632 | size_t | ||
633 | GNUNET_CONTAINER_meta_data_get_thumbnail ( | ||
634 | const struct GNUNET_CONTAINER_MetaData *md, | ||
635 | unsigned char **thumb); | ||
636 | |||
637 | |||
638 | /** | ||
639 | * @ingroup metadata | ||
640 | * Options for metadata serialization. | ||
641 | */ | ||
642 | enum GNUNET_CONTAINER_MetaDataSerializationOptions | ||
643 | { | ||
644 | /** | ||
645 | * @ingroup metadata | ||
646 | * Serialize all of the data. | ||
647 | */ | ||
648 | GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL = 0, | ||
649 | |||
650 | /** | ||
651 | * @ingroup metadata | ||
652 | * If not enough space is available, it is acceptable | ||
653 | * to only serialize some of the metadata. | ||
654 | */ | ||
655 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART = 1, | ||
656 | |||
657 | /** | ||
658 | * @ingroup metadata | ||
659 | * Speed is of the essence, do not allow compression. | ||
660 | */ | ||
661 | GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS = 2 | ||
662 | }; | ||
663 | |||
664 | |||
665 | /** | ||
666 | * @ingroup metadata | ||
667 | * Serialize meta-data to target. | ||
668 | * | ||
669 | * @param md metadata to serialize | ||
670 | * @param target where to write the serialized metadata; | ||
671 | * *target can be NULL, in which case memory is allocated | ||
672 | * @param max maximum number of bytes available | ||
673 | * @param opt is it ok to just write SOME of the | ||
674 | * meta-data to match the size constraint, | ||
675 | * possibly discarding some data? | ||
676 | * @return number of bytes written on success, | ||
677 | * -1 on error (typically: not enough | ||
678 | * space) | ||
679 | */ | ||
680 | ssize_t | ||
681 | GNUNET_CONTAINER_meta_data_serialize ( | ||
682 | const struct GNUNET_CONTAINER_MetaData *md, | ||
683 | char **target, | ||
684 | size_t max, | ||
685 | enum GNUNET_CONTAINER_MetaDataSerializationOptions opt); | ||
686 | |||
687 | |||
688 | /** | ||
689 | * @ingroup metadata | ||
690 | * Get the size of the full meta-data in serialized form. | ||
691 | * | ||
692 | * @param md metadata to inspect | ||
693 | * @return number of bytes needed for serialization, -1 on error | ||
694 | */ | ||
695 | ssize_t | ||
696 | GNUNET_CONTAINER_meta_data_get_serialized_size ( | ||
697 | const struct GNUNET_CONTAINER_MetaData *md); | ||
698 | |||
699 | |||
700 | /** | ||
701 | * @ingroup metadata | ||
702 | * Deserialize meta-data. Initializes md. | ||
703 | * | ||
704 | * @param input serialized meta-data. | ||
705 | * @param size number of bytes available | ||
706 | * @return MD on success, NULL on error (e.g. | ||
707 | * bad format) | ||
708 | */ | ||
709 | struct GNUNET_CONTAINER_MetaData * | ||
710 | GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size); | ||
711 | |||
712 | 328 | ||
713 | /* ******************************* HashMap **************************** */ | 329 | /* ******************************* HashMap **************************** */ |
714 | 330 | ||
@@ -1264,10 +880,10 @@ GNUNET_CONTAINER_multipeermap_iterator_create ( | |||
1264 | * position. If there are no elements left, #GNUNET_NO is returned, | 880 | * position. If there are no elements left, #GNUNET_NO is returned, |
1265 | * and @a key and @a value are not modified. | 881 | * and @a key and @a value are not modified. |
1266 | * | 882 | * |
1267 | * This operation is only allowed if no elements have been removed | 883 | * This operation is only allowed if no elements have been removed |
1268 | * from the multihashmap since the creation of @a iter, and the map | 884 | * from the multihashmap since the creation of @a iter, and the map |
1269 | * has not been destroyed. | 885 | * has not been destroyed. |
1270 | * | 886 | * |
1271 | * Adding elements may result in repeating or skipping elements. | 887 | * Adding elements may result in repeating or skipping elements. |
1272 | * | 888 | * |
1273 | * @param iter the iterator to get the next element from | 889 | * @param iter the iterator to get the next element from |
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index e201c2cf3..7d54914d1 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h | |||
@@ -61,6 +61,7 @@ extern "C" | |||
61 | #endif | 61 | #endif |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | |||
64 | #include "gnunet_util_lib.h" | 65 | #include "gnunet_util_lib.h" |
65 | #include "gnunet_identity_service.h" | 66 | #include "gnunet_identity_service.h" |
66 | #include "gnunet_namestore_service.h" | 67 | #include "gnunet_namestore_service.h" |
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 4b824980b..4e188df87 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -43,6 +43,7 @@ extern "C" { | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
47 | #include "gnunet_transport_service.h" | 48 | #include "gnunet_transport_service.h" |
48 | 49 | ||
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 36e6743b3..8d400118a 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -44,6 +44,10 @@ | |||
44 | * @see [Documentation](https://gnunet.org/crypto-api) | 44 | * @see [Documentation](https://gnunet.org/crypto-api) |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
48 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
49 | #endif | ||
50 | |||
47 | #ifndef GNUNET_CRYPTO_LIB_H | 51 | #ifndef GNUNET_CRYPTO_LIB_H |
48 | #define GNUNET_CRYPTO_LIB_H | 52 | #define GNUNET_CRYPTO_LIB_H |
49 | 53 | ||
@@ -54,6 +58,7 @@ extern "C" { | |||
54 | #endif | 58 | #endif |
55 | #endif | 59 | #endif |
56 | 60 | ||
61 | |||
57 | #include <stdbool.h> | 62 | #include <stdbool.h> |
58 | #include <sodium.h> | 63 | #include <sodium.h> |
59 | 64 | ||
@@ -62,7 +67,6 @@ extern "C" { | |||
62 | */ | 67 | */ |
63 | struct GNUNET_PeerIdentity; | 68 | struct GNUNET_PeerIdentity; |
64 | 69 | ||
65 | #include "gnunet_common.h" | ||
66 | #include <gcrypt.h> | 70 | #include <gcrypt.h> |
67 | 71 | ||
68 | 72 | ||
diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index 92334887d..bdf3843b1 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h | |||
@@ -32,6 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | #ifndef GNUNET_CURL_LIB_H | 33 | #ifndef GNUNET_CURL_LIB_H |
34 | #define GNUNET_CURL_LIB_H | 34 | #define GNUNET_CURL_LIB_H |
35 | |||
35 | #include <curl/curl.h> | 36 | #include <curl/curl.h> |
36 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
37 | 38 | ||
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h index 5a876af8c..2c7bf1e8f 100644 --- a/src/include/gnunet_datacache_lib.h +++ b/src/include/gnunet_datacache_lib.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef GNUNET_DATACACHE_LIB_H | 40 | #ifndef GNUNET_DATACACHE_LIB_H |
41 | #define GNUNET_DATACACHE_LIB_H | 41 | #define GNUNET_DATACACHE_LIB_H |
42 | 42 | ||
43 | |||
43 | #include "gnunet_util_lib.h" | 44 | #include "gnunet_util_lib.h" |
44 | #include "gnunet_block_lib.h" | 45 | #include "gnunet_block_lib.h" |
45 | #include "gnunet_dht_service.h" | 46 | #include "gnunet_dht_service.h" |
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h index 298623cb1..e144e155e 100644 --- a/src/include/gnunet_datacache_plugin.h +++ b/src/include/gnunet_datacache_plugin.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef PLUGIN_DATACACHE_H | 34 | #ifndef PLUGIN_DATACACHE_H |
35 | #define PLUGIN_DATACACHE_H | 35 | #define PLUGIN_DATACACHE_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_datacache_lib.h" | 38 | #include "gnunet_datacache_lib.h" |
38 | 39 | ||
39 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_datastore_plugin.h b/src/include/gnunet_datastore_plugin.h index 3de08b788..c4f31c7ce 100644 --- a/src/include/gnunet_datastore_plugin.h +++ b/src/include/gnunet_datastore_plugin.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef PLUGIN_DATASTORE_H | 34 | #ifndef PLUGIN_DATASTORE_H |
35 | #define PLUGIN_DATASTORE_H | 35 | #define PLUGIN_DATASTORE_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_block_lib.h" | 38 | #include "gnunet_block_lib.h" |
38 | #include "gnunet_configuration_lib.h" | 39 | #include "gnunet_configuration_lib.h" |
39 | #include "gnunet_datastore_service.h" | 40 | #include "gnunet_datastore_service.h" |
@@ -101,17 +102,17 @@ struct GNUNET_DATASTORE_PluginEnvironment | |||
101 | * @return #GNUNET_OK to keep the item | 102 | * @return #GNUNET_OK to keep the item |
102 | * #GNUNET_NO to delete the item | 103 | * #GNUNET_NO to delete the item |
103 | */ | 104 | */ |
104 | typedef int | 105 | typedef enum GNUNET_GenericReturnValue |
105 | (*PluginDatumProcessor) (void *cls, | 106 | (*PluginDatumProcessor)(void *cls, |
106 | const struct GNUNET_HashCode *key, | 107 | const struct GNUNET_HashCode *key, |
107 | uint32_t size, | 108 | uint32_t size, |
108 | const void *data, | 109 | const void *data, |
109 | enum GNUNET_BLOCK_Type type, | 110 | enum GNUNET_BLOCK_Type type, |
110 | uint32_t priority, | 111 | uint32_t priority, |
111 | uint32_t anonymity, | 112 | uint32_t anonymity, |
112 | uint32_t replication, | 113 | uint32_t replication, |
113 | struct GNUNET_TIME_Absolute expiration, | 114 | struct GNUNET_TIME_Absolute expiration, |
114 | uint64_t uid); | 115 | uint64_t uid); |
115 | 116 | ||
116 | 117 | ||
117 | /** | 118 | /** |
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index c2ec9ce1f..153387238 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #ifndef GNUNET_DATASTORE_SERVICE_H | 42 | #ifndef GNUNET_DATASTORE_SERVICE_H |
43 | #define GNUNET_DATASTORE_SERVICE_H | 43 | #define GNUNET_DATASTORE_SERVICE_H |
44 | 44 | ||
45 | |||
45 | #include "gnunet_util_lib.h" | 46 | #include "gnunet_util_lib.h" |
46 | #include "gnunet_block_lib.h" | 47 | #include "gnunet_block_lib.h" |
47 | 48 | ||
diff --git a/src/include/gnunet_db_lib.h b/src/include/gnunet_db_lib.h index e88e836f6..1ff665c2b 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 | |||
28 | #include "gnunet_common.h" | 29 | #include "gnunet_common.h" |
29 | 30 | ||
30 | /** | 31 | /** |
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 0d1041a88..3d1264991 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #ifndef GNUNET_DHT_SERVICE_H | 40 | #ifndef GNUNET_DHT_SERVICE_H |
41 | #define GNUNET_DHT_SERVICE_H | 41 | #define GNUNET_DHT_SERVICE_H |
42 | 42 | ||
43 | |||
43 | #include "gnunet_util_lib.h" | 44 | #include "gnunet_util_lib.h" |
44 | #include "gnunet_block_lib.h" | 45 | #include "gnunet_block_lib.h" |
45 | #include "gnunet_hello_lib.h" | 46 | #include "gnunet_hello_lib.h" |
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h index 81b0f1d7b..0503dda1c 100644 --- a/src/include/gnunet_dhtu_plugin.h +++ b/src/include/gnunet_dhtu_plugin.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #ifndef PLUGIN_DHTU_H | 27 | #ifndef PLUGIN_DHTU_H |
28 | #define PLUGIN_DHTU_H | 28 | #define PLUGIN_DHTU_H |
29 | 29 | ||
30 | |||
30 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
31 | 32 | ||
32 | 33 | ||
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index c76cdc231..b14c5e59d 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -31,6 +31,11 @@ | |||
31 | * Disk IO APIs | 31 | * Disk IO APIs |
32 | * @{ | 32 | * @{ |
33 | */ | 33 | */ |
34 | |||
35 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
36 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
37 | #endif | ||
38 | |||
34 | #ifndef GNUNET_DISK_LIB_H | 39 | #ifndef GNUNET_DISK_LIB_H |
35 | #define GNUNET_DISK_LIB_H | 40 | #define GNUNET_DISK_LIB_H |
36 | 41 | ||
@@ -76,6 +81,7 @@ struct GNUNET_DISK_FileHandle | |||
76 | or unsigned long long, this IS platform dependent; | 81 | or unsigned long long, this IS platform dependent; |
77 | but "stdlib.h" should be portable 'enough' to be | 82 | but "stdlib.h" should be portable 'enough' to be |
78 | unconditionally available... */ | 83 | unconditionally available... */ |
84 | |||
79 | #include <stdlib.h> | 85 | #include <stdlib.h> |
80 | #include "gnunet_configuration_lib.h" | 86 | #include "gnunet_configuration_lib.h" |
81 | #include "gnunet_scheduler_lib.h" | 87 | #include "gnunet_scheduler_lib.h" |
diff --git a/src/include/gnunet_dns_service.h b/src/include/gnunet_dns_service.h index fd1319dd9..b5741a7e2 100644 --- a/src/include/gnunet_dns_service.h +++ b/src/include/gnunet_dns_service.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #ifndef GNUNET_DNS_SERVICE_H | 36 | #ifndef GNUNET_DNS_SERVICE_H |
37 | #define GNUNET_DNS_SERVICE_H | 37 | #define GNUNET_DNS_SERVICE_H |
38 | 38 | ||
39 | |||
39 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
40 | 41 | ||
41 | 42 | ||
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h index b8b908e84..8064b554b 100644 --- a/src/include/gnunet_dnsparser_lib.h +++ b/src/include/gnunet_dnsparser_lib.h | |||
@@ -18,6 +18,11 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
25 | |||
21 | /** | 26 | /** |
22 | * @addtogroup libgnunetutil | 27 | * @addtogroup libgnunetutil |
23 | * @{ | 28 | * @{ |
@@ -35,8 +40,6 @@ | |||
35 | #ifndef GNUNET_DNSPARSER_LIB_H | 40 | #ifndef GNUNET_DNSPARSER_LIB_H |
36 | #define GNUNET_DNSPARSER_LIB_H | 41 | #define GNUNET_DNSPARSER_LIB_H |
37 | 42 | ||
38 | #include "gnunet_util_lib.h" | ||
39 | |||
40 | /** | 43 | /** |
41 | * Maximum length of a label in DNS. | 44 | * Maximum length of a label in DNS. |
42 | */ | 45 | */ |
diff --git a/src/include/gnunet_dnsstub_lib.h b/src/include/gnunet_dnsstub_lib.h index 4cc5e7fd0..fa5151a8c 100644 --- a/src/include/gnunet_dnsstub_lib.h +++ b/src/include/gnunet_dnsstub_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * @{ | 27 | * @{ |
@@ -34,6 +38,7 @@ | |||
34 | #ifndef GNUNET_DNSSTUB_LIB_H | 38 | #ifndef GNUNET_DNSSTUB_LIB_H |
35 | #define GNUNET_DNSSTUB_LIB_H | 39 | #define GNUNET_DNSSTUB_LIB_H |
36 | 40 | ||
41 | |||
37 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
38 | 43 | ||
39 | /** | 44 | /** |
diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h index bb4a3ee8c..c8e99826a 100644 --- a/src/include/gnunet_fragmentation_lib.h +++ b/src/include/gnunet_fragmentation_lib.h | |||
@@ -37,8 +37,8 @@ | |||
37 | #ifndef GNUNET_FRAGMENTATION_LIB_H | 37 | #ifndef GNUNET_FRAGMENTATION_LIB_H |
38 | #define GNUNET_FRAGMENTATION_LIB_H | 38 | #define GNUNET_FRAGMENTATION_LIB_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
41 | #include "gnunet_bandwidth_lib.h" | ||
42 | #include "gnunet_statistics_service.h" | 42 | #include "gnunet_statistics_service.h" |
43 | 43 | ||
44 | #ifdef __cplusplus | 44 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_friends_lib.h b/src/include/gnunet_friends_lib.h index 03fa6c72d..4f4d5e88b 100644 --- a/src/include/gnunet_friends_lib.h +++ b/src/include/gnunet_friends_lib.h | |||
@@ -42,6 +42,7 @@ extern "C" | |||
42 | #endif | 42 | #endif |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | |||
45 | #include "gnunet_util_lib.h" | 46 | #include "gnunet_util_lib.h" |
46 | 47 | ||
47 | 48 | ||
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index d9f2ee563..5c271c71f 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #ifndef GNUNET_FS_LIB_H | 36 | #ifndef GNUNET_FS_LIB_H |
37 | #define GNUNET_FS_LIB_H | 37 | #define GNUNET_FS_LIB_H |
38 | 38 | ||
39 | |||
40 | #include "gnunet_common.h" | ||
39 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
40 | 42 | ||
41 | #ifdef __cplusplus | 43 | #ifdef __cplusplus |
@@ -69,6 +71,106 @@ extern "C" | |||
69 | */ | 71 | */ |
70 | #define GNUNET_FS_VERSION 0x00090300 | 72 | #define GNUNET_FS_VERSION 0x00090300 |
71 | 73 | ||
74 | #if GNUNET_FS_EXTRACTOR_ENABLED | ||
75 | |||
76 | #include <extractor.h> | ||
77 | |||
78 | #else | ||
79 | |||
80 | /* definitions from extractor.h we need for the build */ | ||
81 | |||
82 | /** | ||
83 | * Enumeration defining various sources of keywords. See also | ||
84 | * http://dublincore.org/documents/1998/09/dces/ | ||
85 | */ | ||
86 | enum EXTRACTOR_MetaType | ||
87 | { | ||
88 | EXTRACTOR_METATYPE_RESERVED = 0, | ||
89 | EXTRACTOR_METATYPE_MIMETYPE = 1, | ||
90 | EXTRACTOR_METATYPE_FILENAME = 2, | ||
91 | EXTRACTOR_METATYPE_COMMENT = 3, | ||
92 | EXTRACTOR_METATYPE_TITLE = 4, | ||
93 | EXTRACTOR_METATYPE_BOOK_TITLE = 5, | ||
94 | EXTRACTOR_METATYPE_JOURNAL_NAME = 8, | ||
95 | EXTRACTOR_METATYPE_AUTHOR_NAME = 13, | ||
96 | EXTRACTOR_METATYPE_PUBLICATION_DATE = 24, | ||
97 | EXTRACTOR_METATYPE_URL = 29, | ||
98 | EXTRACTOR_METATYPE_URI = 30, | ||
99 | EXTRACTOR_METATYPE_ISRC = 31, | ||
100 | EXTRACTOR_METATYPE_UNKNOWN = 45, | ||
101 | EXTRACTOR_METATYPE_DESCRIPTION = 46, | ||
102 | EXTRACTOR_METATYPE_KEYWORDS = 49, | ||
103 | EXTRACTOR_METATYPE_SUBJECT = 52, | ||
104 | EXTRACTOR_METATYPE_PACKAGE_NAME = 69, | ||
105 | EXTRACTOR_METATYPE_THUMBNAIL = 114, | ||
106 | EXTRACTOR_METATYPE_ALBUM = 129, | ||
107 | EXTRACTOR_METATYPE_ARTIST = 130, | ||
108 | EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162, | ||
109 | EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174, | ||
110 | EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180, | ||
111 | }; | ||
112 | |||
113 | /** | ||
114 | * Format in which the extracted meta data is presented. | ||
115 | */ | ||
116 | enum EXTRACTOR_MetaFormat | ||
117 | { | ||
118 | /** | ||
119 | * Format is unknown. | ||
120 | */ | ||
121 | EXTRACTOR_METAFORMAT_UNKNOWN = 0, | ||
122 | |||
123 | /** | ||
124 | * 0-terminated, UTF-8 encoded string. "data_len" | ||
125 | * is strlen(data)+1. | ||
126 | */ | ||
127 | EXTRACTOR_METAFORMAT_UTF8 = 1, | ||
128 | |||
129 | /** | ||
130 | * Some kind of binary format, see given Mime type. | ||
131 | */ | ||
132 | EXTRACTOR_METAFORMAT_BINARY = 2, | ||
133 | |||
134 | /** | ||
135 | * 0-terminated string. The specific encoding is unknown. | ||
136 | * "data_len" is strlen (data)+1. | ||
137 | */ | ||
138 | EXTRACTOR_METAFORMAT_C_STRING = 3 | ||
139 | }; | ||
140 | |||
141 | |||
142 | /** | ||
143 | * Type of a function that libextractor calls for each | ||
144 | * meta data item found. | ||
145 | * | ||
146 | * @param cls closure (user-defined) | ||
147 | * @param plugin_name name of the plugin that produced this value; | ||
148 | * special values can be used (e.g. '<zlib>' for zlib being | ||
149 | * used in the main libextractor library and yielding | ||
150 | * meta data). | ||
151 | * @param type libextractor-type describing the meta data | ||
152 | * @param format basic format information about @a data | ||
153 | * @param data_mime_type mime-type of @a data (not of the original file); | ||
154 | * can be NULL (if mime-type is not known) | ||
155 | * @param data actual meta-data found | ||
156 | * @param data_len number of bytes in @a data | ||
157 | * @return 0 to continue extracting, 1 to abort | ||
158 | */ | ||
159 | typedef int (*EXTRACTOR_MetaDataProcessor) (void *cls, | ||
160 | const char *plugin_name, | ||
161 | enum EXTRACTOR_MetaType type, | ||
162 | enum EXTRACTOR_MetaFormat format, | ||
163 | const char *data_mime_type, | ||
164 | const char *data, | ||
165 | size_t data_len); | ||
166 | |||
167 | #endif | ||
168 | |||
169 | #ifndef EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME | ||
170 | /* hack for LE < 0.6.3 */ | ||
171 | #define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180 | ||
172 | #endif | ||
173 | |||
72 | 174 | ||
73 | /* ******************** URI API *********************** */ | 175 | /* ******************** URI API *********************** */ |
74 | 176 | ||
@@ -91,6 +193,12 @@ extern "C" | |||
91 | */ | 193 | */ |
92 | struct GNUNET_FS_Uri; | 194 | struct GNUNET_FS_Uri; |
93 | 195 | ||
196 | /** | ||
197 | * @ingroup metadata | ||
198 | * Meta data to associate with a file, directory or namespace. | ||
199 | */ | ||
200 | struct GNUNET_FS_MetaData; | ||
201 | |||
94 | 202 | ||
95 | /** | 203 | /** |
96 | * Iterator over keywords | 204 | * Iterator over keywords |
@@ -435,7 +543,7 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | |||
435 | * @return NULL on error, otherwise a KSK URI | 543 | * @return NULL on error, otherwise a KSK URI |
436 | */ | 544 | */ |
437 | struct GNUNET_FS_Uri * | 545 | struct GNUNET_FS_Uri * |
438 | GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | 546 | GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_FS_MetaData |
439 | *md); | 547 | *md); |
440 | 548 | ||
441 | 549 | ||
@@ -471,7 +579,7 @@ GNUNET_FS_GETOPT_METADATA (char shortName, | |||
471 | const char *name, | 579 | const char *name, |
472 | const char *argumentHelp, | 580 | const char *argumentHelp, |
473 | const char *description, | 581 | const char *description, |
474 | struct GNUNET_CONTAINER_MetaData **meta); | 582 | struct GNUNET_FS_MetaData **meta); |
475 | 583 | ||
476 | /** | 584 | /** |
477 | * Command-line option parser function that allows the user to specify | 585 | * Command-line option parser function that allows the user to specify |
@@ -480,7 +588,7 @@ GNUNET_FS_GETOPT_METADATA (char shortName, | |||
480 | * the metadata must be passed as the "scls" argument. | 588 | * the metadata must be passed as the "scls" argument. |
481 | * | 589 | * |
482 | * @param ctx command line processor context | 590 | * @param ctx command line processor context |
483 | * @param scls must be of type `struct GNUNET_CONTAINER_MetaData **` | 591 | * @param scls must be of type `struct GNUNET_FS_MetaData **` |
484 | * @param option name of the option (typically 'k') | 592 | * @param option name of the option (typically 'k') |
485 | * @param value command line argument given | 593 | * @param value command line argument given |
486 | * @return #GNUNET_OK on success | 594 | * @return #GNUNET_OK on success |
@@ -1098,7 +1206,7 @@ struct GNUNET_FS_ProgressInfo | |||
1098 | /** | 1206 | /** |
1099 | * Known metadata for the download. | 1207 | * Known metadata for the download. |
1100 | */ | 1208 | */ |
1101 | const struct GNUNET_CONTAINER_MetaData *meta; | 1209 | const struct GNUNET_FS_MetaData *meta; |
1102 | } start; | 1210 | } start; |
1103 | 1211 | ||
1104 | /** | 1212 | /** |
@@ -1110,7 +1218,7 @@ struct GNUNET_FS_ProgressInfo | |||
1110 | /** | 1218 | /** |
1111 | * Known metadata for the download. | 1219 | * Known metadata for the download. |
1112 | */ | 1220 | */ |
1113 | const struct GNUNET_CONTAINER_MetaData *meta; | 1221 | const struct GNUNET_FS_MetaData *meta; |
1114 | 1222 | ||
1115 | /** | 1223 | /** |
1116 | * Error message, NULL if we have not encountered any error yet. | 1224 | * Error message, NULL if we have not encountered any error yet. |
@@ -1195,7 +1303,7 @@ struct GNUNET_FS_ProgressInfo | |||
1195 | /** | 1303 | /** |
1196 | * Metadata for the search result. | 1304 | * Metadata for the search result. |
1197 | */ | 1305 | */ |
1198 | const struct GNUNET_CONTAINER_MetaData *meta; | 1306 | const struct GNUNET_FS_MetaData *meta; |
1199 | 1307 | ||
1200 | /** | 1308 | /** |
1201 | * URI for the search result. | 1309 | * URI for the search result. |
@@ -1223,7 +1331,7 @@ struct GNUNET_FS_ProgressInfo | |||
1223 | /** | 1331 | /** |
1224 | * Metadata for the search result. | 1332 | * Metadata for the search result. |
1225 | */ | 1333 | */ |
1226 | const struct GNUNET_CONTAINER_MetaData *meta; | 1334 | const struct GNUNET_FS_MetaData *meta; |
1227 | 1335 | ||
1228 | /** | 1336 | /** |
1229 | * URI for the search result. | 1337 | * URI for the search result. |
@@ -1270,7 +1378,7 @@ struct GNUNET_FS_ProgressInfo | |||
1270 | /** | 1378 | /** |
1271 | * Metadata for the search result. | 1379 | * Metadata for the search result. |
1272 | */ | 1380 | */ |
1273 | const struct GNUNET_CONTAINER_MetaData *meta; | 1381 | const struct GNUNET_FS_MetaData *meta; |
1274 | 1382 | ||
1275 | /** | 1383 | /** |
1276 | * URI for the search result. | 1384 | * URI for the search result. |
@@ -1322,7 +1430,7 @@ struct GNUNET_FS_ProgressInfo | |||
1322 | /** | 1430 | /** |
1323 | * Metadata for the search result. | 1431 | * Metadata for the search result. |
1324 | */ | 1432 | */ |
1325 | const struct GNUNET_CONTAINER_MetaData *meta; | 1433 | const struct GNUNET_FS_MetaData *meta; |
1326 | 1434 | ||
1327 | /** | 1435 | /** |
1328 | * URI for the search result. | 1436 | * URI for the search result. |
@@ -1350,7 +1458,7 @@ struct GNUNET_FS_ProgressInfo | |||
1350 | /** | 1458 | /** |
1351 | * Metadata for the search result. | 1459 | * Metadata for the search result. |
1352 | */ | 1460 | */ |
1353 | const struct GNUNET_CONTAINER_MetaData *meta; | 1461 | const struct GNUNET_FS_MetaData *meta; |
1354 | 1462 | ||
1355 | /** | 1463 | /** |
1356 | * URI for the search result. | 1464 | * URI for the search result. |
@@ -1405,7 +1513,7 @@ struct GNUNET_FS_ProgressInfo | |||
1405 | /** | 1513 | /** |
1406 | * Metadata for the namespace. | 1514 | * Metadata for the namespace. |
1407 | */ | 1515 | */ |
1408 | const struct GNUNET_CONTAINER_MetaData *meta; | 1516 | const struct GNUNET_FS_MetaData *meta; |
1409 | 1517 | ||
1410 | /** | 1518 | /** |
1411 | * Public key of the namespace. | 1519 | * Public key of the namespace. |
@@ -1705,7 +1813,7 @@ typedef int | |||
1705 | (*GNUNET_FS_FileInformationProcessor) (void *cls, | 1813 | (*GNUNET_FS_FileInformationProcessor) (void *cls, |
1706 | struct GNUNET_FS_FileInformation *fi, | 1814 | struct GNUNET_FS_FileInformation *fi, |
1707 | uint64_t length, | 1815 | uint64_t length, |
1708 | struct GNUNET_CONTAINER_MetaData *meta, | 1816 | struct GNUNET_FS_MetaData *meta, |
1709 | struct GNUNET_FS_Uri **uri, | 1817 | struct GNUNET_FS_Uri **uri, |
1710 | struct GNUNET_FS_BlockOptions *bo, | 1818 | struct GNUNET_FS_BlockOptions *bo, |
1711 | int *do_index, | 1819 | int *do_index, |
@@ -1770,7 +1878,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | |||
1770 | const struct | 1878 | const struct |
1771 | GNUNET_FS_Uri *keywords, | 1879 | GNUNET_FS_Uri *keywords, |
1772 | const struct | 1880 | const struct |
1773 | GNUNET_CONTAINER_MetaData *meta, | 1881 | GNUNET_FS_MetaData *meta, |
1774 | int do_index, | 1882 | int do_index, |
1775 | const struct | 1883 | const struct |
1776 | GNUNET_FS_BlockOptions *bo); | 1884 | GNUNET_FS_BlockOptions *bo); |
@@ -1800,7 +1908,7 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | |||
1800 | const struct | 1908 | const struct |
1801 | GNUNET_FS_Uri *keywords, | 1909 | GNUNET_FS_Uri *keywords, |
1802 | const struct | 1910 | const struct |
1803 | GNUNET_CONTAINER_MetaData *meta, | 1911 | GNUNET_FS_MetaData *meta, |
1804 | int do_index, | 1912 | int do_index, |
1805 | const struct | 1913 | const struct |
1806 | GNUNET_FS_BlockOptions *bo); | 1914 | GNUNET_FS_BlockOptions *bo); |
@@ -1859,7 +1967,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | |||
1859 | const struct GNUNET_FS_Uri | 1967 | const struct GNUNET_FS_Uri |
1860 | *keywords, | 1968 | *keywords, |
1861 | const struct | 1969 | const struct |
1862 | GNUNET_CONTAINER_MetaData *meta, | 1970 | GNUNET_FS_MetaData *meta, |
1863 | int do_index, | 1971 | int do_index, |
1864 | const struct | 1972 | const struct |
1865 | GNUNET_FS_BlockOptions *bo); | 1973 | GNUNET_FS_BlockOptions *bo); |
@@ -1883,7 +1991,7 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | |||
1883 | const struct GNUNET_FS_Uri | 1991 | const struct GNUNET_FS_Uri |
1884 | *keywords, | 1992 | *keywords, |
1885 | const struct | 1993 | const struct |
1886 | GNUNET_CONTAINER_MetaData | 1994 | GNUNET_FS_MetaData |
1887 | *meta, | 1995 | *meta, |
1888 | const struct | 1996 | const struct |
1889 | GNUNET_FS_BlockOptions *bo, | 1997 | GNUNET_FS_BlockOptions *bo, |
@@ -2042,7 +2150,7 @@ struct GNUNET_FS_PublishKskContext; | |||
2042 | struct GNUNET_FS_PublishKskContext * | 2150 | struct GNUNET_FS_PublishKskContext * |
2043 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | 2151 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, |
2044 | const struct GNUNET_FS_Uri *ksk_uri, | 2152 | const struct GNUNET_FS_Uri *ksk_uri, |
2045 | const struct GNUNET_CONTAINER_MetaData *meta, | 2153 | const struct GNUNET_FS_MetaData *meta, |
2046 | const struct GNUNET_FS_Uri *uri, | 2154 | const struct GNUNET_FS_Uri *uri, |
2047 | const struct GNUNET_FS_BlockOptions *bo, | 2155 | const struct GNUNET_FS_BlockOptions *bo, |
2048 | enum GNUNET_FS_PublishOptions options, | 2156 | enum GNUNET_FS_PublishOptions options, |
@@ -2084,7 +2192,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
2084 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, | 2192 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, |
2085 | const char *identifier, | 2193 | const char *identifier, |
2086 | const char *update, | 2194 | const char *update, |
2087 | const struct GNUNET_CONTAINER_MetaData *meta, | 2195 | const struct GNUNET_FS_MetaData *meta, |
2088 | const struct GNUNET_FS_Uri *uri, | 2196 | const struct GNUNET_FS_Uri *uri, |
2089 | const struct GNUNET_FS_BlockOptions *bo, | 2197 | const struct GNUNET_FS_BlockOptions *bo, |
2090 | enum GNUNET_FS_PublishOptions options, | 2198 | enum GNUNET_FS_PublishOptions options, |
@@ -2180,7 +2288,7 @@ typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, | |||
2180 | const struct | 2288 | const struct |
2181 | GNUNET_FS_Uri *last_uri, | 2289 | GNUNET_FS_Uri *last_uri, |
2182 | const struct | 2290 | const struct |
2183 | GNUNET_CONTAINER_MetaData * | 2291 | GNUNET_FS_MetaData * |
2184 | last_meta, | 2292 | last_meta, |
2185 | const char *next_id); | 2293 | const char *next_id); |
2186 | 2294 | ||
@@ -2290,7 +2398,7 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); | |||
2290 | struct GNUNET_FS_SearchResult * | 2398 | struct GNUNET_FS_SearchResult * |
2291 | GNUNET_FS_probe (struct GNUNET_FS_Handle *h, | 2399 | GNUNET_FS_probe (struct GNUNET_FS_Handle *h, |
2292 | const struct GNUNET_FS_Uri *uri, | 2400 | const struct GNUNET_FS_Uri *uri, |
2293 | const struct GNUNET_CONTAINER_MetaData *meta, | 2401 | const struct GNUNET_FS_MetaData *meta, |
2294 | void *client_info, | 2402 | void *client_info, |
2295 | uint32_t anonymity); | 2403 | uint32_t anonymity); |
2296 | 2404 | ||
@@ -2378,7 +2486,7 @@ enum GNUNET_FS_DownloadOptions | |||
2378 | struct GNUNET_FS_DownloadContext * | 2486 | struct GNUNET_FS_DownloadContext * |
2379 | GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | 2487 | GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, |
2380 | const struct GNUNET_FS_Uri *uri, | 2488 | const struct GNUNET_FS_Uri *uri, |
2381 | const struct GNUNET_CONTAINER_MetaData *meta, | 2489 | const struct GNUNET_FS_MetaData *meta, |
2382 | const char *filename, const char *tempname, | 2490 | const char *filename, const char *tempname, |
2383 | uint64_t offset, uint64_t length, uint32_t anonymity, | 2491 | uint64_t offset, uint64_t length, uint32_t anonymity, |
2384 | enum GNUNET_FS_DownloadOptions options, void *cctx, | 2492 | enum GNUNET_FS_DownloadOptions options, void *cctx, |
@@ -2472,7 +2580,7 @@ GNUNET_FS_download_resume (struct GNUNET_FS_DownloadContext *dc); | |||
2472 | * we have no mime-type information (treat as #GNUNET_NO) | 2580 | * we have no mime-type information (treat as #GNUNET_NO) |
2473 | */ | 2581 | */ |
2474 | int | 2582 | int |
2475 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData | 2583 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_FS_MetaData |
2476 | *md); | 2584 | *md); |
2477 | 2585 | ||
2478 | 2586 | ||
@@ -2483,7 +2591,7 @@ GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData | |||
2483 | * @param md metadata to add mimetype to | 2591 | * @param md metadata to add mimetype to |
2484 | */ | 2592 | */ |
2485 | void | 2593 | void |
2486 | GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | 2594 | GNUNET_FS_meta_data_make_directory (struct GNUNET_FS_MetaData *md); |
2487 | 2595 | ||
2488 | 2596 | ||
2489 | /** | 2597 | /** |
@@ -2494,7 +2602,7 @@ GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | |||
2494 | */ | 2602 | */ |
2495 | char * | 2603 | char * |
2496 | GNUNET_FS_meta_data_suggest_filename (const struct | 2604 | GNUNET_FS_meta_data_suggest_filename (const struct |
2497 | GNUNET_CONTAINER_MetaData *md); | 2605 | GNUNET_FS_MetaData *md); |
2498 | 2606 | ||
2499 | 2607 | ||
2500 | /** | 2608 | /** |
@@ -2517,7 +2625,7 @@ typedef void (*GNUNET_FS_DirectoryEntryProcessor) (void *cls, | |||
2517 | const struct GNUNET_FS_Uri * | 2625 | const struct GNUNET_FS_Uri * |
2518 | uri, | 2626 | uri, |
2519 | const struct | 2627 | const struct |
2520 | GNUNET_CONTAINER_MetaData * | 2628 | GNUNET_FS_MetaData * |
2521 | meta, size_t length, | 2629 | meta, size_t length, |
2522 | const void *data); | 2630 | const void *data); |
2523 | 2631 | ||
@@ -2560,7 +2668,7 @@ struct GNUNET_FS_DirectoryBuilder; | |||
2560 | * @param mdir metadata for the directory | 2668 | * @param mdir metadata for the directory |
2561 | */ | 2669 | */ |
2562 | struct GNUNET_FS_DirectoryBuilder * | 2670 | struct GNUNET_FS_DirectoryBuilder * |
2563 | GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData | 2671 | GNUNET_FS_directory_builder_create (const struct GNUNET_FS_MetaData |
2564 | *mdir); | 2672 | *mdir); |
2565 | 2673 | ||
2566 | 2674 | ||
@@ -2577,7 +2685,7 @@ GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData | |||
2577 | void | 2685 | void |
2578 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | 2686 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, |
2579 | const struct GNUNET_FS_Uri *uri, | 2687 | const struct GNUNET_FS_Uri *uri, |
2580 | const struct GNUNET_CONTAINER_MetaData *md, | 2688 | const struct GNUNET_FS_MetaData *md, |
2581 | const void *data); | 2689 | const void *data); |
2582 | 2690 | ||
2583 | 2691 | ||
@@ -2692,7 +2800,7 @@ struct GNUNET_FS_ShareTreeItem | |||
2692 | /** | 2800 | /** |
2693 | * Metadata for this file or directory | 2801 | * Metadata for this file or directory |
2694 | */ | 2802 | */ |
2695 | struct GNUNET_CONTAINER_MetaData *meta; | 2803 | struct GNUNET_FS_MetaData *meta; |
2696 | 2804 | ||
2697 | /** | 2805 | /** |
2698 | * Keywords for this file or directory (derived from metadata). | 2806 | * Keywords for this file or directory (derived from metadata). |
@@ -2781,6 +2889,336 @@ GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel); | |||
2781 | void | 2889 | void |
2782 | GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel); | 2890 | GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel); |
2783 | 2891 | ||
2892 | /** | ||
2893 | * Meta data processing | ||
2894 | * @defgroup metadata Metadata | ||
2895 | * GNU libextractor key-value pairs | ||
2896 | */ | ||
2897 | |||
2898 | |||
2899 | /* ****************** metadata ******************* */ | ||
2900 | |||
2901 | |||
2902 | /** | ||
2903 | * @ingroup metadata | ||
2904 | * Create a fresh meta data container. | ||
2905 | * | ||
2906 | * @return empty meta-data container | ||
2907 | */ | ||
2908 | struct GNUNET_FS_MetaData * | ||
2909 | GNUNET_FS_meta_data_create (void); | ||
2910 | |||
2911 | |||
2912 | /** | ||
2913 | * @ingroup metadata | ||
2914 | * Duplicate a MetaData token. | ||
2915 | * | ||
2916 | * @param md what to duplicate | ||
2917 | * @return duplicate meta-data container | ||
2918 | */ | ||
2919 | struct GNUNET_FS_MetaData * | ||
2920 | GNUNET_FS_meta_data_duplicate ( | ||
2921 | const struct GNUNET_FS_MetaData *md); | ||
2922 | |||
2923 | |||
2924 | /** | ||
2925 | * @ingroup metadata | ||
2926 | * Free meta data. | ||
2927 | * | ||
2928 | * @param md what to free | ||
2929 | */ | ||
2930 | void | ||
2931 | GNUNET_FS_meta_data_destroy (struct GNUNET_FS_MetaData *md); | ||
2932 | |||
2933 | |||
2934 | /** | ||
2935 | * @ingroup metadata | ||
2936 | * Test if two MDs are equal. We consider them equal if | ||
2937 | * the meta types, formats and content match (we do not | ||
2938 | * include the mime types and plugins names in this | ||
2939 | * consideration). | ||
2940 | * | ||
2941 | * @param md1 first value to check | ||
2942 | * @param md2 other value to check | ||
2943 | * @return #GNUNET_YES if they are equal | ||
2944 | */ | ||
2945 | int | ||
2946 | GNUNET_FS_meta_data_test_equal ( | ||
2947 | const struct GNUNET_FS_MetaData *md1, | ||
2948 | const struct GNUNET_FS_MetaData *md2); | ||
2949 | |||
2950 | |||
2951 | /** | ||
2952 | * @ingroup metadata | ||
2953 | * Extend metadata. | ||
2954 | * | ||
2955 | * @param md metadata to extend | ||
2956 | * @param plugin_name name of the plugin that produced this value; | ||
2957 | * special values can be used (e.g. '<zlib>' for zlib being | ||
2958 | * used in the main libextractor library and yielding | ||
2959 | * meta data). | ||
2960 | * @param type libextractor-type describing the meta data | ||
2961 | * @param format basic format information about data | ||
2962 | * @param data_mime_type mime-type of data (not of the original file); | ||
2963 | * can be NULL (if mime-type is not known) | ||
2964 | * @param data actual meta-data found | ||
2965 | * @param data_size number of bytes in data | ||
2966 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if this entry already exists | ||
2967 | * data_mime_type and plugin_name are not considered for "exists" checks | ||
2968 | */ | ||
2969 | int | ||
2970 | GNUNET_FS_meta_data_insert (struct GNUNET_FS_MetaData *md, | ||
2971 | const char *plugin_name, | ||
2972 | enum EXTRACTOR_MetaType type, | ||
2973 | enum EXTRACTOR_MetaFormat format, | ||
2974 | const char *data_mime_type, | ||
2975 | const char *data, | ||
2976 | size_t data_size); | ||
2977 | |||
2978 | |||
2979 | /** | ||
2980 | * @ingroup metadata | ||
2981 | * Extend metadata. Merges the meta data from the second argument | ||
2982 | * into the first, discarding duplicate key-value pairs. | ||
2983 | * | ||
2984 | * @param md metadata to extend | ||
2985 | * @param in metadata to merge | ||
2986 | */ | ||
2987 | void | ||
2988 | GNUNET_FS_meta_data_merge (struct GNUNET_FS_MetaData *md, | ||
2989 | const struct GNUNET_FS_MetaData *in); | ||
2990 | |||
2991 | |||
2992 | /** | ||
2993 | * @ingroup metadata | ||
2994 | * Remove an item. | ||
2995 | * | ||
2996 | * @param md metadata to manipulate | ||
2997 | * @param type type of the item to remove | ||
2998 | * @param data specific value to remove, NULL to remove all | ||
2999 | * entries of the given type | ||
3000 | * @param data_size number of bytes in data | ||
3001 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the item does not exist in md | ||
3002 | */ | ||
3003 | int | ||
3004 | GNUNET_FS_meta_data_delete (struct GNUNET_FS_MetaData *md, | ||
3005 | enum EXTRACTOR_MetaType type, | ||
3006 | const char *data, | ||
3007 | size_t data_size); | ||
3008 | |||
3009 | |||
3010 | /** | ||
3011 | * @ingroup metadata | ||
3012 | * Remove all items in the container. | ||
3013 | * | ||
3014 | * @param md metadata to manipulate | ||
3015 | */ | ||
3016 | void | ||
3017 | GNUNET_FS_meta_data_clear (struct GNUNET_FS_MetaData *md); | ||
3018 | |||
3019 | |||
3020 | /** | ||
3021 | * @ingroup metadata | ||
3022 | * Add the current time as the publication date | ||
3023 | * to the meta-data. | ||
3024 | * | ||
3025 | * @param md metadata to modify | ||
3026 | */ | ||
3027 | void | ||
3028 | GNUNET_FS_meta_data_add_publication_date ( | ||
3029 | struct GNUNET_FS_MetaData *md); | ||
3030 | |||
3031 | |||
3032 | /** | ||
3033 | * @ingroup metadata | ||
3034 | * Iterate over MD entries. | ||
3035 | * | ||
3036 | * @param md metadata to inspect | ||
3037 | * @param iter function to call on each entry, return 0 to continue to iterate | ||
3038 | * and 1 to abort iteration in this function (GNU libextractor API!) | ||
3039 | * @param iter_cls closure for @a iter | ||
3040 | * @return number of entries | ||
3041 | */ | ||
3042 | int | ||
3043 | GNUNET_FS_meta_data_iterate (const struct GNUNET_FS_MetaData *md, | ||
3044 | EXTRACTOR_MetaDataProcessor iter, | ||
3045 | void *iter_cls); | ||
3046 | |||
3047 | |||
3048 | /** | ||
3049 | * @ingroup metadata | ||
3050 | * Get the first MD entry of the given type. Caller | ||
3051 | * is responsible for freeing the return value. | ||
3052 | * Also, only meta data items that are strings (0-terminated) | ||
3053 | * are returned by this function. | ||
3054 | * | ||
3055 | * @param md metadata to inspect | ||
3056 | * @param type type to look for | ||
3057 | * @return NULL if no entry was found | ||
3058 | */ | ||
3059 | char * | ||
3060 | GNUNET_FS_meta_data_get_by_type ( | ||
3061 | const struct GNUNET_FS_MetaData *md, | ||
3062 | enum EXTRACTOR_MetaType type); | ||
3063 | |||
3064 | |||
3065 | /** | ||
3066 | * @ingroup metadata | ||
3067 | * Get the first matching MD entry of the given types. Caller is | ||
3068 | * responsible for freeing the return value. Also, only meta data | ||
3069 | * items that are strings (0-terminated) are returned by this | ||
3070 | * function. | ||
3071 | * | ||
3072 | * @param md metadata to inspect | ||
3073 | * @param ... -1-terminated list of types | ||
3074 | * @return NULL if we do not have any such entry, | ||
3075 | * otherwise client is responsible for freeing the value! | ||
3076 | */ | ||
3077 | char * | ||
3078 | GNUNET_FS_meta_data_get_first_by_types ( | ||
3079 | const struct GNUNET_FS_MetaData *md, | ||
3080 | ...); | ||
3081 | |||
3082 | /** | ||
3083 | * @ingroup metadata | ||
3084 | * Get a thumbnail from the meta-data (if present). Only matches meta | ||
3085 | * data with mime type "image" and binary format. | ||
3086 | * | ||
3087 | * @param md metadata to inspect | ||
3088 | * @param thumb will be set to the thumbnail data. Must be | ||
3089 | * freed by the caller! | ||
3090 | * @return number of bytes in thumbnail, 0 if not available | ||
3091 | */ | ||
3092 | size_t | ||
3093 | GNUNET_FS_meta_data_get_thumbnail ( | ||
3094 | const struct GNUNET_FS_MetaData *md, | ||
3095 | unsigned char **thumb); | ||
3096 | |||
3097 | |||
3098 | /** | ||
3099 | * @ingroup metadata | ||
3100 | * Options for metadata serialization. | ||
3101 | */ | ||
3102 | enum GNUNET_FS_MetaDataSerializationOptions | ||
3103 | { | ||
3104 | /** | ||
3105 | * @ingroup metadata | ||
3106 | * Serialize all of the data. | ||
3107 | */ | ||
3108 | GNUNET_FS_META_DATA_SERIALIZE_FULL = 0, | ||
3109 | |||
3110 | /** | ||
3111 | * @ingroup metadata | ||
3112 | * If not enough space is available, it is acceptable | ||
3113 | * to only serialize some of the metadata. | ||
3114 | */ | ||
3115 | GNUNET_FS_META_DATA_SERIALIZE_PART = 1, | ||
3116 | |||
3117 | /** | ||
3118 | * @ingroup metadata | ||
3119 | * Speed is of the essence, do not allow compression. | ||
3120 | */ | ||
3121 | GNUNET_FS_META_DATA_SERIALIZE_NO_COMPRESS = 2 | ||
3122 | }; | ||
3123 | |||
3124 | |||
3125 | /** | ||
3126 | * @ingroup metadata | ||
3127 | * Serialize meta-data to target. | ||
3128 | * | ||
3129 | * @param md metadata to serialize | ||
3130 | * @param target where to write the serialized metadata; | ||
3131 | * *target can be NULL, in which case memory is allocated | ||
3132 | * @param max maximum number of bytes available | ||
3133 | * @param opt is it ok to just write SOME of the | ||
3134 | * meta-data to match the size constraint, | ||
3135 | * possibly discarding some data? | ||
3136 | * @return number of bytes written on success, | ||
3137 | * -1 on error (typically: not enough | ||
3138 | * space) | ||
3139 | */ | ||
3140 | ssize_t | ||
3141 | GNUNET_FS_meta_data_serialize ( | ||
3142 | const struct GNUNET_FS_MetaData *md, | ||
3143 | char **target, | ||
3144 | size_t max, | ||
3145 | enum GNUNET_FS_MetaDataSerializationOptions opt); | ||
3146 | |||
3147 | |||
3148 | /** | ||
3149 | * @ingroup metadata | ||
3150 | * Get the size of the full meta-data in serialized form. | ||
3151 | * | ||
3152 | * @param md metadata to inspect | ||
3153 | * @return number of bytes needed for serialization, -1 on error | ||
3154 | */ | ||
3155 | ssize_t | ||
3156 | GNUNET_FS_meta_data_get_serialized_size ( | ||
3157 | const struct GNUNET_FS_MetaData *md); | ||
3158 | |||
3159 | |||
3160 | /** | ||
3161 | * @ingroup metadata | ||
3162 | * Deserialize meta-data. Initializes md. | ||
3163 | * | ||
3164 | * @param input serialized meta-data. | ||
3165 | * @param size number of bytes available | ||
3166 | * @return MD on success, NULL on error (e.g. | ||
3167 | * bad format) | ||
3168 | */ | ||
3169 | struct GNUNET_FS_MetaData * | ||
3170 | GNUNET_FS_meta_data_deserialize (const char *input, size_t size); | ||
3171 | |||
3172 | /** | ||
3173 | * Write a metadata container. | ||
3174 | * | ||
3175 | * @param h the IO handle to write to | ||
3176 | * @param what what is being written (for error message creation) | ||
3177 | * @param m metadata to write | ||
3178 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
3179 | */ | ||
3180 | enum GNUNET_GenericReturnValue | ||
3181 | GNUNET_FS_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | ||
3182 | const char *what, | ||
3183 | const struct GNUNET_FS_MetaData *m); | ||
3184 | |||
3185 | /** | ||
3186 | * Create the specification to read a metadata container. | ||
3187 | * | ||
3188 | * @param what describes what is being read (for error message creation) | ||
3189 | * @param result the buffer to store a pointer to the (allocated) metadata | ||
3190 | * @return the read spec | ||
3191 | */ | ||
3192 | struct GNUNET_BIO_ReadSpec | ||
3193 | GNUNET_FS_read_spec_meta_data (const char *what, | ||
3194 | struct GNUNET_FS_MetaData **result); | ||
3195 | |||
3196 | |||
3197 | |||
3198 | /** | ||
3199 | * Create the specification to write a metadata container. | ||
3200 | * | ||
3201 | * @param what what is being written (for error message creation) | ||
3202 | * @param m metadata to write | ||
3203 | * @return the write spec | ||
3204 | */ | ||
3205 | struct GNUNET_BIO_WriteSpec | ||
3206 | GNUNET_FS_write_spec_meta_data (const char *what, | ||
3207 | const struct GNUNET_FS_MetaData *m); | ||
3208 | |||
3209 | /** | ||
3210 | * Read a metadata container. | ||
3211 | * | ||
3212 | * @param h handle to an open file | ||
3213 | * @param what describes what is being read (for error message creation) | ||
3214 | * @param result the buffer to store a pointer to the (allocated) metadata | ||
3215 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
3216 | */ | ||
3217 | enum GNUNET_GenericReturnValue | ||
3218 | GNUNET_FS_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | ||
3219 | const char *what, | ||
3220 | struct GNUNET_FS_MetaData **result); | ||
3221 | |||
2784 | 3222 | ||
2785 | #if 0 /* keep Emacsens' auto-indent happy */ | 3223 | #if 0 /* keep Emacsens' auto-indent happy */ |
2786 | { | 3224 | { |
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index 87ad591b7..390e8c153 100644 --- a/src/include/gnunet_getopt_lib.h +++ b/src/include/gnunet_getopt_lib.h | |||
@@ -33,6 +33,10 @@ | |||
33 | * @{ | 33 | * @{ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
37 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
38 | #endif | ||
39 | |||
36 | #ifndef GNUNET_GETOPT_LIB_H | 40 | #ifndef GNUNET_GETOPT_LIB_H |
37 | #define GNUNET_GETOPT_LIB_H | 41 | #define GNUNET_GETOPT_LIB_H |
38 | 42 | ||
@@ -43,6 +47,7 @@ extern "C" { | |||
43 | #endif | 47 | #endif |
44 | #endif | 48 | #endif |
45 | 49 | ||
50 | |||
46 | #include "gnunet_configuration_lib.h" | 51 | #include "gnunet_configuration_lib.h" |
47 | 52 | ||
48 | /** | 53 | /** |
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index a32bb77ae..1fcf7aa8b 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -37,8 +37,8 @@ | |||
37 | #ifndef GNUNET_GNS_SERVICE_H | 37 | #ifndef GNUNET_GNS_SERVICE_H |
38 | #define GNUNET_GNS_SERVICE_H | 38 | #define GNUNET_GNS_SERVICE_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
41 | #include "gnunet_dnsparser_lib.h" | ||
42 | #include "gnunet_identity_service.h" | 42 | #include "gnunet_identity_service.h" |
43 | #include "gnunet_namestore_service.h" | 43 | #include "gnunet_namestore_service.h" |
44 | 44 | ||
diff --git a/src/include/gnunet_gnsrecord_json_lib.h b/src/include/gnunet_gnsrecord_json_lib.h index 833e684f9..1216f1f5e 100644 --- a/src/include/gnunet_gnsrecord_json_lib.h +++ b/src/include/gnunet_gnsrecord_json_lib.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef GNUNET_GNSRECORD_JSON_LIB_H | 37 | #ifndef GNUNET_GNSRECORD_JSON_LIB_H |
38 | #define GNUNET_GNSRECORD_JSON_LIB_H | 38 | #define GNUNET_GNSRECORD_JSON_LIB_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_gnsrecord_lib.h" | 41 | #include "gnunet_gnsrecord_lib.h" |
41 | #include "gnunet_json_lib.h" | 42 | #include "gnunet_json_lib.h" |
42 | 43 | ||
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 85a42d459..6fc2a05c5 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef GNUNET_GNSRECORD_LIB_H | 37 | #ifndef GNUNET_GNSRECORD_LIB_H |
38 | #define GNUNET_GNSRECORD_LIB_H | 38 | #define GNUNET_GNSRECORD_LIB_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_identity_service.h" | 41 | #include "gnunet_identity_service.h" |
41 | 42 | ||
42 | #ifdef __cplusplus | 43 | #ifdef __cplusplus |
@@ -69,46 +70,9 @@ extern "C" { | |||
69 | #include "gnu_name_system_record_types.h" | 70 | #include "gnu_name_system_record_types.h" |
70 | 71 | ||
71 | /** | 72 | /** |
72 | * Flags that can be set for a record. | 73 | * Include the record flags generated from GANA |
73 | * MUST fit into 16 bit. | ||
74 | */ | 74 | */ |
75 | enum GNUNET_GNSRECORD_Flags | 75 | #include "gnu_name_system_record_flags.h" |
76 | { | ||
77 | /** | ||
78 | * No special options. | ||
79 | */ | ||
80 | GNUNET_GNSRECORD_RF_NONE = 0, | ||
81 | |||
82 | /** | ||
83 | * This record is critical. If it cannot be processed | ||
84 | * (for example because the record type is unknown) | ||
85 | * resolution MUST fail | ||
86 | */ | ||
87 | GNUNET_GNSRECORD_RF_CRITICAL = 1, | ||
88 | |||
89 | /** | ||
90 | * This record should not be used unless all (other) records with an absolute | ||
91 | * expiration time have expired. | ||
92 | */ | ||
93 | GNUNET_GNSRECORD_RF_SHADOW_RECORD = 2, | ||
94 | |||
95 | /** | ||
96 | * This is a supplemental record. | ||
97 | */ | ||
98 | GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 4, | ||
99 | |||
100 | /** | ||
101 | * This expiration time of the record is a relative | ||
102 | * time (not an absolute time). | ||
103 | */ | ||
104 | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 16384, /* 2^14 */ | ||
105 | |||
106 | /** | ||
107 | * This is a private record of this peer and it should | ||
108 | * thus not be handed out to other peers. | ||
109 | */ | ||
110 | GNUNET_GNSRECORD_RF_PRIVATE = 32768, /* 2^15 */ | ||
111 | |||
112 | 76 | ||
113 | /** | 77 | /** |
114 | * When comparing flags for record equality for removal, | 78 | * When comparing flags for record equality for removal, |
@@ -122,7 +86,6 @@ enum GNUNET_GNSRECORD_Flags | |||
122 | * #GNUNET_GNSRECORD_records_cmp. | 86 | * #GNUNET_GNSRECORD_records_cmp. |
123 | */ | 87 | */ |
124 | #define GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) | 88 | #define GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) |
125 | }; | ||
126 | 89 | ||
127 | /** | 90 | /** |
128 | * Filter for GNUNET_GNSRECORD_normalize_record_set(). | 91 | * Filter for GNUNET_GNSRECORD_normalize_record_set(). |
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index 86bf35110..20a61cbfb 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -44,6 +44,7 @@ extern "C" { | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_util_lib.h" | 48 | #include "gnunet_util_lib.h" |
48 | 49 | ||
49 | /** | 50 | /** |
diff --git a/src/include/gnunet_hello_uri_lib.h b/src/include/gnunet_hello_uri_lib.h index 89cd42d31..bba7078e6 100644 --- a/src/include/gnunet_hello_uri_lib.h +++ b/src/include/gnunet_hello_uri_lib.h | |||
@@ -42,6 +42,7 @@ extern "C" { | |||
42 | #endif | 42 | #endif |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | |||
45 | #include "gnunet_util_lib.h" | 46 | #include "gnunet_util_lib.h" |
46 | 47 | ||
47 | 48 | ||
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h index 3362d698e..2279abb24 100644 --- a/src/include/gnunet_helper_lib.h +++ b/src/include/gnunet_helper_lib.h | |||
@@ -38,10 +38,14 @@ | |||
38 | * @{ | 38 | * @{ |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
42 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
43 | #endif | ||
44 | |||
41 | #ifndef GNUNET_HELPER_LIB_H | 45 | #ifndef GNUNET_HELPER_LIB_H |
42 | #define GNUNET_HELPER_LIB_H | 46 | #define GNUNET_HELPER_LIB_H |
43 | 47 | ||
44 | #include "gnunet_scheduler_lib.h" | 48 | |
45 | #include "gnunet_mst_lib.h" | 49 | #include "gnunet_mst_lib.h" |
46 | 50 | ||
47 | 51 | ||
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index cd745ba51..67327af5d 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -52,6 +52,7 @@ extern "C" { | |||
52 | #endif | 52 | #endif |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | |||
55 | #include "gnunet_util_lib.h" | 56 | #include "gnunet_util_lib.h" |
56 | 57 | ||
57 | 58 | ||
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index 8809afb71..a65293a7c 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #ifndef GNUNET_JSON_LIB_H | 27 | #ifndef GNUNET_JSON_LIB_H |
28 | #define GNUNET_JSON_LIB_H | 28 | #define GNUNET_JSON_LIB_H |
29 | 29 | ||
30 | |||
30 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
31 | #include <jansson.h> | 32 | #include <jansson.h> |
32 | #include <microhttpd.h> | 33 | #include <microhttpd.h> |
diff --git a/src/include/gnunet_load_lib.h b/src/include/gnunet_load_lib.h index 397d3aa2d..56cacfbbb 100644 --- a/src/include/gnunet_load_lib.h +++ b/src/include/gnunet_load_lib.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_common.h" | 47 | #include "gnunet_common.h" |
47 | #include "gnunet_time_lib.h" | 48 | #include "gnunet_time_lib.h" |
48 | 49 | ||
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index 12f021d35..07d22d85c 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h | |||
@@ -39,11 +39,11 @@ extern "C" { | |||
39 | #endif | 39 | #endif |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | |||
42 | #include "platform.h" | 43 | #include "platform.h" |
43 | #include "gnunet_configuration_lib.h" | 44 | #include "gnunet_configuration_lib.h" |
44 | #include "gnunet_crypto_lib.h" | 45 | #include "gnunet_util_lib.h" |
45 | #include "gnunet_identity_service.h" | 46 | #include "gnunet_identity_service.h" |
46 | #include "gnunet_mq_lib.h" | ||
47 | #include "gnunet_protocols.h" | 47 | #include "gnunet_protocols.h" |
48 | #include "gnunet_scheduler_lib.h" | 48 | #include "gnunet_scheduler_lib.h" |
49 | #include "gnunet_time_lib.h" | 49 | #include "gnunet_time_lib.h" |
diff --git a/src/include/gnunet_mhd_compat.h b/src/include/gnunet_mhd_compat.h index 0cfcc6445..7ef297c2f 100644 --- a/src/include/gnunet_mhd_compat.h +++ b/src/include/gnunet_mhd_compat.h | |||
@@ -25,6 +25,7 @@ | |||
25 | * MHD compatibility definitions for warning-less compile of | 25 | * MHD compatibility definitions for warning-less compile of |
26 | * our code against MHD before and after #MHD_VERSION 0x00097002. | 26 | * our code against MHD before and after #MHD_VERSION 0x00097002. |
27 | */ | 27 | */ |
28 | |||
28 | #include <microhttpd.h> | 29 | #include <microhttpd.h> |
29 | 30 | ||
30 | #if MHD_VERSION >= 0x00097002 | 31 | #if MHD_VERSION >= 0x00097002 |
@@ -35,7 +36,7 @@ | |||
35 | 36 | ||
36 | #else | 37 | #else |
37 | 38 | ||
38 | /** | 39 | ** |
39 | * Data type to use for functions return an "MHD result". | 40 | * Data type to use for functions return an "MHD result". |
40 | */ | 41 | */ |
41 | #define MHD_RESULT int | 42 | #define MHD_RESULT int |
diff --git a/src/include/gnunet_microphone_lib.h b/src/include/gnunet_microphone_lib.h index 479c7a71e..394caed68 100644 --- a/src/include/gnunet_microphone_lib.h +++ b/src/include/gnunet_microphone_lib.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_util_lib.h" | 48 | #include "gnunet_util_lib.h" |
48 | 49 | ||
49 | /** | 50 | /** |
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index a06fb4eb7..95e8c619b 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h | |||
@@ -18,6 +18,11 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
25 | |||
21 | /** | 26 | /** |
22 | * @addtogroup libgnunetutil | 27 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 28 | * Multi-function utilities library for GNUnet programs |
@@ -39,6 +44,7 @@ | |||
39 | #ifndef GNUNET_MQ_LIB_H | 44 | #ifndef GNUNET_MQ_LIB_H |
40 | #define GNUNET_MQ_LIB_H | 45 | #define GNUNET_MQ_LIB_H |
41 | 46 | ||
47 | |||
42 | #include "gnunet_scheduler_lib.h" | 48 | #include "gnunet_scheduler_lib.h" |
43 | 49 | ||
44 | /** | 50 | /** |
diff --git a/src/include/gnunet_mst_lib.h b/src/include/gnunet_mst_lib.h index ec82ce357..af2dd3353 100644 --- a/src/include/gnunet_mst_lib.h +++ b/src/include/gnunet_mst_lib.h | |||
@@ -39,6 +39,10 @@ | |||
39 | * @{ | 39 | * @{ |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
43 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
44 | #endif | ||
45 | |||
42 | #ifndef GNUNET_MST_LIB_H | 46 | #ifndef GNUNET_MST_LIB_H |
43 | #define GNUNET_MST_LIB_H | 47 | #define GNUNET_MST_LIB_H |
44 | 48 | ||
@@ -50,8 +54,6 @@ extern "C" | |||
50 | #endif | 54 | #endif |
51 | #endif | 55 | #endif |
52 | 56 | ||
53 | #include "gnunet_common.h" | ||
54 | |||
55 | 57 | ||
56 | /** | 58 | /** |
57 | * Handle to a message stream tokenizer. | 59 | * Handle to a message stream tokenizer. |
diff --git a/src/include/gnunet_my_lib.h b/src/include/gnunet_my_lib.h index 96d8cab42..283b2f7e6 100644 --- a/src/include/gnunet_my_lib.h +++ b/src/include/gnunet_my_lib.h | |||
@@ -18,11 +18,12 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @addtogroup lib_extra | 21 | * @addtogroup lib_extra |
22 | * @{ | 22 | * @{ |
23 | * | 23 | * |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Christophe Genevey | 25 | * @author Christophe Genevey |
26 | * @author Martin Schanzenbach | ||
26 | * | 27 | * |
27 | * @file | 28 | * @file |
28 | * Helper library to access a MySQL database | 29 | * Helper library to access a MySQL database |
@@ -34,10 +35,15 @@ | |||
34 | #ifndef GNUNET_MY_LIB_H | 35 | #ifndef GNUNET_MY_LIB_H |
35 | #define GNUNET_MY_LIB_H | 36 | #define GNUNET_MY_LIB_H |
36 | 37 | ||
38 | |||
37 | #include "gnunet_util_lib.h" | 39 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_mysql_lib.h" | 40 | #include "gnunet_mysql_lib.h" |
39 | #include <mysql/mysql.h> | 41 | #include <mysql/mysql.h> |
40 | 42 | ||
43 | #ifndef MYSQL_BOOL | ||
44 | #error "You need to define MYSQL_BOOL. See (or include) gnunet_mysql_compat.h" | ||
45 | #endif | ||
46 | |||
41 | #ifdef __cplusplus | 47 | #ifdef __cplusplus |
42 | extern "C" | 48 | extern "C" |
43 | { | 49 | { |
diff --git a/src/include/gnunet_mysql_compat.h b/src/include/gnunet_mysql_compat.h new file mode 100644 index 000000000..bb1e8de8a --- /dev/null +++ b/src/include/gnunet_mysql_compat.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2022 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 | * @author Martin Schanzenbach | ||
22 | * | ||
23 | * @file | ||
24 | * MySQL/MariaDB compatibility insanity helper header | ||
25 | * | ||
26 | * @defgroup mysql MySQL library | ||
27 | * Helper library to access a MySQL database. | ||
28 | * @{ | ||
29 | */ | ||
30 | #ifndef GNUNET_MYSQL_COMPAT_H | ||
31 | #define GNUNET_MYSQL_COMPAT_H | ||
32 | |||
33 | |||
34 | #include <mysql/mysql.h> | ||
35 | |||
36 | #ifdef __cplusplus | ||
37 | extern "C" | ||
38 | { | ||
39 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
40 | } | ||
41 | #endif | ||
42 | #endif | ||
43 | |||
44 | #ifndef LIBMARIADB | ||
45 | #if MYSQL_VERSION_ID < 80000 | ||
46 | #define MYSQL_BOOL bool; | ||
47 | #else | ||
48 | #define MYSQL_BOOL my_bool; //MySQL < 8 wants this | ||
49 | #endif | ||
50 | #else | ||
51 | #define MYSQL_BOOL my_bool //MariaDB still uses my_bool | ||
52 | #endif | ||
53 | |||
54 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
55 | { | ||
56 | #endif | ||
57 | #ifdef __cplusplus | ||
58 | } | ||
59 | #endif | ||
60 | |||
61 | #endif | ||
62 | |||
63 | /** @} */ /* end of group */ | ||
diff --git a/src/include/gnunet_mysql_lib.h b/src/include/gnunet_mysql_lib.h index 8da7e5397..52be3ff11 100644 --- a/src/include/gnunet_mysql_lib.h +++ b/src/include/gnunet_mysql_lib.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #ifndef GNUNET_MYSQL_LIB_H | 30 | #ifndef GNUNET_MYSQL_LIB_H |
31 | #define GNUNET_MYSQL_LIB_H | 31 | #define GNUNET_MYSQL_LIB_H |
32 | 32 | ||
33 | |||
33 | #include "gnunet_util_lib.h" | 34 | #include "gnunet_util_lib.h" |
34 | #include <mysql/mysql.h> | 35 | #include <mysql/mysql.h> |
35 | 36 | ||
@@ -41,17 +42,6 @@ extern "C" | |||
41 | #endif | 42 | #endif |
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | #ifndef LIBMARIADB | ||
45 | #ifdef HAVE_MYSQL8 && !LIBMARIADB | ||
46 | typedef bool MYSQL_BOOL; | ||
47 | #else | ||
48 | typedef my_bool MYSQL_BOOL; //MySQL < 8 wants this | ||
49 | #endif | ||
50 | #else | ||
51 | typedef my_bool MYSQL_BOOL; //MariaDB still uses my_bool | ||
52 | #endif | ||
53 | |||
54 | |||
55 | /** | 45 | /** |
56 | * Mysql context. | 46 | * Mysql context. |
57 | */ | 47 | */ |
diff --git a/src/include/gnunet_namecache_plugin.h b/src/include/gnunet_namecache_plugin.h index c41c516c8..a3848bf4e 100644 --- a/src/include/gnunet_namecache_plugin.h +++ b/src/include/gnunet_namecache_plugin.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #ifndef GNUNET_NAMECACHE_PLUGIN_H | 37 | #ifndef GNUNET_NAMECACHE_PLUGIN_H |
38 | #define GNUNET_NAMECACHE_PLUGIN_H | 38 | #define GNUNET_NAMECACHE_PLUGIN_H |
39 | 39 | ||
40 | |||
40 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
41 | #include "gnunet_namecache_service.h" | 42 | #include "gnunet_namecache_service.h" |
42 | #include "gnunet_namestore_service.h" | 43 | #include "gnunet_namestore_service.h" |
diff --git a/src/include/gnunet_namecache_service.h b/src/include/gnunet_namecache_service.h index fbc9f7e62..669386c37 100644 --- a/src/include/gnunet_namecache_service.h +++ b/src/include/gnunet_namecache_service.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #ifndef GNUNET_NAMECACHE_SERVICE_H | 41 | #ifndef GNUNET_NAMECACHE_SERVICE_H |
42 | #define GNUNET_NAMECACHE_SERVICE_H | 42 | #define GNUNET_NAMECACHE_SERVICE_H |
43 | 43 | ||
44 | |||
44 | #include "gnunet_util_lib.h" | 45 | #include "gnunet_util_lib.h" |
45 | #include "gnunet_block_lib.h" | 46 | #include "gnunet_block_lib.h" |
46 | #include "gnunet_namestore_service.h" | 47 | #include "gnunet_namestore_service.h" |
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index 1df0a5eb0..f2bdf7cc6 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_NAMESTORE_PLUGIN_H | 34 | #ifndef GNUNET_NAMESTORE_PLUGIN_H |
35 | #define GNUNET_NAMESTORE_PLUGIN_H | 35 | #define GNUNET_NAMESTORE_PLUGIN_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_namestore_service.h" | 39 | #include "gnunet_namestore_service.h" |
39 | 40 | ||
@@ -88,12 +89,12 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
88 | * @param rd array of records with data to store | 89 | * @param rd array of records with data to store |
89 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 90 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
90 | */ | 91 | */ |
91 | int | 92 | enum GNUNET_GenericReturnValue |
92 | (*store_records) (void *cls, | 93 | (*store_records)(void *cls, |
93 | const struct GNUNET_IDENTITY_PrivateKey *zone, | 94 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
94 | const char *label, | 95 | const char *label, |
95 | unsigned int rd_count, | 96 | unsigned int rd_count, |
96 | const struct GNUNET_GNSRECORD_Data *rd); | 97 | const struct GNUNET_GNSRECORD_Data *rd); |
97 | 98 | ||
98 | /** | 99 | /** |
99 | * Lookup records in the datastore for which we are the authority. | 100 | * Lookup records in the datastore for which we are the authority. |
@@ -105,12 +106,12 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
105 | * @param iter_cls closure for @a iter | 106 | * @param iter_cls closure for @a iter |
106 | * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR | 107 | * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR |
107 | */ | 108 | */ |
108 | int | 109 | enum GNUNET_GenericReturnValue |
109 | (*lookup_records) (void *cls, | 110 | (*lookup_records)(void *cls, |
110 | const struct GNUNET_IDENTITY_PrivateKey *zone, | 111 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
111 | const char *label, | 112 | const char *label, |
112 | GNUNET_NAMESTORE_RecordIterator iter, | 113 | GNUNET_NAMESTORE_RecordIterator iter, |
113 | void *iter_cls); | 114 | void *iter_cls); |
114 | 115 | ||
115 | 116 | ||
116 | /** | 117 | /** |
@@ -127,13 +128,13 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
127 | * @param iter_cls closure for @a iter | 128 | * @param iter_cls closure for @a iter |
128 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no more results, #GNUNET_SYSERR on error | 129 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no more results, #GNUNET_SYSERR on error |
129 | */ | 130 | */ |
130 | int | 131 | enum GNUNET_GenericReturnValue |
131 | (*iterate_records) (void *cls, | 132 | (*iterate_records)(void *cls, |
132 | const struct GNUNET_IDENTITY_PrivateKey *zone, | 133 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
133 | uint64_t serial, | 134 | uint64_t serial, |
134 | uint64_t limit, | 135 | uint64_t limit, |
135 | GNUNET_NAMESTORE_RecordIterator iter, | 136 | GNUNET_NAMESTORE_RecordIterator iter, |
136 | void *iter_cls); | 137 | void *iter_cls); |
137 | 138 | ||
138 | 139 | ||
139 | /** | 140 | /** |
@@ -147,12 +148,12 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
147 | * @param iter_cls closure for @a iter | 148 | * @param iter_cls closure for @a iter |
148 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error | 149 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
149 | */ | 150 | */ |
150 | int | 151 | enum GNUNET_GenericReturnValue |
151 | (*zone_to_name) (void *cls, | 152 | (*zone_to_name)(void *cls, |
152 | const struct GNUNET_IDENTITY_PrivateKey *zone, | 153 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
153 | const struct GNUNET_IDENTITY_PublicKey *value_zone, | 154 | const struct GNUNET_IDENTITY_PublicKey *value_zone, |
154 | GNUNET_NAMESTORE_RecordIterator iter, | 155 | GNUNET_NAMESTORE_RecordIterator iter, |
155 | void *iter_cls); | 156 | void *iter_cls); |
156 | 157 | ||
157 | /** Transaction-based API draft **/ | 158 | /** Transaction-based API draft **/ |
158 | 159 | ||
@@ -164,7 +165,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
164 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 165 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
165 | */ | 166 | */ |
166 | enum GNUNET_GenericReturnValue | 167 | enum GNUNET_GenericReturnValue |
167 | (*transaction_begin) (void *cls, char **emsg); | 168 | (*transaction_begin)(void *cls, char **emsg); |
168 | 169 | ||
169 | /** | 170 | /** |
170 | * Abort and roll back a transaction in the database | 171 | * Abort and roll back a transaction in the database |
@@ -174,7 +175,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
174 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 175 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
175 | */ | 176 | */ |
176 | enum GNUNET_GenericReturnValue | 177 | enum GNUNET_GenericReturnValue |
177 | (*transaction_rollback) (void *cls, char **emsg); | 178 | (*transaction_rollback)(void *cls, char **emsg); |
178 | 179 | ||
179 | /** | 180 | /** |
180 | * Commit a transaction in the database | 181 | * Commit a transaction in the database |
@@ -184,7 +185,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
184 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 185 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
185 | */ | 186 | */ |
186 | enum GNUNET_GenericReturnValue | 187 | enum GNUNET_GenericReturnValue |
187 | (*transaction_commit) (void *cls, char **emsg); | 188 | (*transaction_commit)(void *cls, char **emsg); |
188 | 189 | ||
189 | /** | 190 | /** |
190 | * Edit records in the datastore for which we are the authority. | 191 | * Edit records in the datastore for which we are the authority. |
@@ -198,35 +199,32 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
198 | * @param iter_cls closure for @a iter | 199 | * @param iter_cls closure for @a iter |
199 | * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR | 200 | * @return #GNUNET_OK on success, #GNUNET_NO for no results, else #GNUNET_SYSERR |
200 | */ | 201 | */ |
201 | int | 202 | enum GNUNET_GenericReturnValue |
202 | (*edit_records) (void *cls, | 203 | (*edit_records)(void *cls, |
203 | const struct GNUNET_IDENTITY_PrivateKey *zone, | 204 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
204 | const char *label, | 205 | const char *label, |
205 | GNUNET_NAMESTORE_RecordIterator iter, | 206 | GNUNET_NAMESTORE_RecordIterator iter, |
206 | void *iter_cls); | 207 | void *iter_cls); |
207 | 208 | ||
208 | /** | 209 | /** |
209 | * Setup the database. | 210 | * Setup the database. |
210 | * Note that this will also fail if the database is already initialized. | ||
211 | * See reset_database(). | ||
212 | * | 211 | * |
213 | * @param cls closure (internal context for the plugin) | 212 | * @param cls closure (internal context for the plugin) |
214 | * @param emsg error message on failure. Will be allocated, must be freed. | ||
215 | * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR | 213 | * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR |
216 | */ | 214 | */ |
217 | int | 215 | enum GNUNET_GenericReturnValue |
218 | (*initialize_database) (void *cls, char **emsg); | 216 | (*create_tables)(void *cls); |
217 | |||
219 | 218 | ||
220 | /** | 219 | /** |
221 | * Re-initializes the database. | 220 | * Drop existing tables. |
222 | * DANGEROUS: All existing data in the dabase will be lost! | 221 | * DANGEROUS: All existing data in the dabase will be lost! |
223 | * | 222 | * |
224 | * @param cls closure (internal context for the plugin) | 223 | * @param cls closure (internal context for the plugin) |
225 | * @param emsg error message on failure. Will be allocated, must be freed. | ||
226 | * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR | 224 | * @return #GNUNET_OK on success, else fails with #GNUNET_SYSERR |
227 | */ | 225 | */ |
228 | int | 226 | enum GNUNET_GenericReturnValue |
229 | (*reset_database) (void *cls, char **emsg); | 227 | (*drop_tables)(void *cls); |
230 | }; | 228 | }; |
231 | 229 | ||
232 | 230 | ||
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 39449be5d..b93a345c7 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #ifndef GNUNET_NAMESTORE_SERVICE_H | 41 | #ifndef GNUNET_NAMESTORE_SERVICE_H |
42 | #define GNUNET_NAMESTORE_SERVICE_H | 42 | #define GNUNET_NAMESTORE_SERVICE_H |
43 | 43 | ||
44 | |||
44 | #include "gnunet_error_codes.h" | 45 | #include "gnunet_error_codes.h" |
45 | #include "gnunet_util_lib.h" | 46 | #include "gnunet_util_lib.h" |
46 | #include "gnunet_block_lib.h" | 47 | #include "gnunet_block_lib.h" |
diff --git a/src/include/gnunet_nat_auto_service.h b/src/include/gnunet_nat_auto_service.h index db3a8460d..1c511cac3 100644 --- a/src/include/gnunet_nat_auto_service.h +++ b/src/include/gnunet_nat_auto_service.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_NAT_AUTO_SERVICE_H | 34 | #ifndef GNUNET_NAT_AUTO_SERVICE_H |
35 | #define GNUNET_NAT_AUTO_SERVICE_H | 35 | #define GNUNET_NAT_AUTO_SERVICE_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_nat_service.h" | 39 | #include "gnunet_nat_service.h" |
39 | 40 | ||
diff --git a/src/include/gnunet_nat_service.h b/src/include/gnunet_nat_service.h index e39e2c016..f2854a0be 100644 --- a/src/include/gnunet_nat_service.h +++ b/src/include/gnunet_nat_service.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #ifndef GNUNET_NAT_SERVICE_H | 36 | #ifndef GNUNET_NAT_SERVICE_H |
37 | #define GNUNET_NAT_SERVICE_H | 37 | #define GNUNET_NAT_SERVICE_H |
38 | 38 | ||
39 | |||
39 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
40 | 41 | ||
41 | 42 | ||
@@ -385,6 +386,12 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh, | |||
385 | * handle. This frees the handle, after having sent the needed | 386 | * handle. This frees the handle, after having sent the needed |
386 | * commands to close open ports. | 387 | * commands to close open ports. |
387 | * | 388 | * |
389 | * FIXME: No, the implementation of this API does not do anything beyond | ||
390 | * cleaning up the handle. | ||
391 | * This is a problem for applications that use #GNUNET_NAT_AddressCallback | ||
392 | * and use the app_ctx to store objects, because the callback will never be | ||
393 | * called for cleanup on unregister. | ||
394 | * | ||
388 | * @param nh the handle to unregister | 395 | * @param nh the handle to unregister |
389 | */ | 396 | */ |
390 | void | 397 | void |
diff --git a/src/include/gnunet_nc_lib.h b/src/include/gnunet_nc_lib.h index dbd2aa12f..8f4d9a16f 100644 --- a/src/include/gnunet_nc_lib.h +++ b/src/include/gnunet_nc_lib.h | |||
@@ -17,6 +17,12 @@ | |||
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | |||
21 | |||
22 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
23 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
24 | #endif | ||
25 | |||
20 | /** | 26 | /** |
21 | * @addtogroup libgnunetutil | 27 | * @addtogroup libgnunetutil |
22 | * Multi-function utilities library for GNUnet programs | 28 | * Multi-function utilities library for GNUnet programs |
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h index 1e8b7e851..8d71d7764 100644 --- a/src/include/gnunet_network_lib.h +++ b/src/include/gnunet_network_lib.h | |||
@@ -52,6 +52,7 @@ extern "C" | |||
52 | * Include "sys/select.h" because it is required to use | 52 | * Include "sys/select.h" because it is required to use |
53 | * "fd_set" in "struct GNUNET_NETWORK_FDSet"! | 53 | * "fd_set" in "struct GNUNET_NETWORK_FDSet"! |
54 | */ | 54 | */ |
55 | |||
55 | #include <sys/select.h> | 56 | #include <sys/select.h> |
56 | //#endif | 57 | //#endif |
57 | #ifdef HAVE_SYS_SOCKET_H | 58 | #ifdef HAVE_SYS_SOCKET_H |
diff --git a/src/include/gnunet_nse_service.h b/src/include/gnunet_nse_service.h index 7fe57a179..fe9e1f853 100644 --- a/src/include/gnunet_nse_service.h +++ b/src/include/gnunet_nse_service.h | |||
@@ -50,6 +50,7 @@ extern "C" | |||
50 | #endif | 50 | #endif |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | |||
53 | #include "gnunet_util_lib.h" | 54 | #include "gnunet_util_lib.h" |
54 | 55 | ||
55 | /** | 56 | /** |
diff --git a/src/include/gnunet_op_lib.h b/src/include/gnunet_op_lib.h index 0e09457cc..e028fb7fb 100644 --- a/src/include/gnunet_op_lib.h +++ b/src/include/gnunet_op_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -32,6 +36,7 @@ | |||
32 | #ifndef GNUNET_OP_H | 36 | #ifndef GNUNET_OP_H |
33 | #define GNUNET_OP_H | 37 | #define GNUNET_OP_H |
34 | 38 | ||
39 | |||
35 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
36 | 41 | ||
37 | /** | 42 | /** |
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index fc88e1123..015282054 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -60,10 +64,6 @@ extern "C" | |||
60 | #endif | 64 | #endif |
61 | #endif | 65 | #endif |
62 | 66 | ||
63 | #include "gnunet_common.h" | ||
64 | #include "gnunet_configuration_lib.h" | ||
65 | #include "gnunet_scheduler_lib.h" | ||
66 | |||
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Flags that determine which of the standard streams | 69 | * Flags that determine which of the standard streams |
diff --git a/src/include/gnunet_peer_lib.h b/src/include/gnunet_peer_lib.h index e088743e6..4a67878b9 100644 --- a/src/include/gnunet_peer_lib.h +++ b/src/include/gnunet_peer_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -36,6 +40,7 @@ | |||
36 | #ifndef GNUNET_PEER_LIB_H | 40 | #ifndef GNUNET_PEER_LIB_H |
37 | #define GNUNET_PEER_LIB_H | 41 | #define GNUNET_PEER_LIB_H |
38 | 42 | ||
43 | |||
39 | #include "gnunet_util_lib.h" | 44 | #include "gnunet_util_lib.h" |
40 | 45 | ||
41 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 3be4a6977..806de963c 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -39,9 +39,9 @@ | |||
39 | #ifndef GNUNET_PEERINFO_SERVICE_H | 39 | #ifndef GNUNET_PEERINFO_SERVICE_H |
40 | #define GNUNET_PEERINFO_SERVICE_H | 40 | #define GNUNET_PEERINFO_SERVICE_H |
41 | 41 | ||
42 | |||
42 | #include "gnunet_common.h" | 43 | #include "gnunet_common.h" |
43 | #include "gnunet_configuration_lib.h" | 44 | #include "gnunet_util_lib.h" |
44 | #include "gnunet_crypto_lib.h" | ||
45 | #include "gnunet_hello_lib.h" | 45 | #include "gnunet_hello_lib.h" |
46 | 46 | ||
47 | #ifdef __cplusplus | 47 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_peerstore_plugin.h b/src/include/gnunet_peerstore_plugin.h index fab3d41f9..2636c3009 100644 --- a/src/include/gnunet_peerstore_plugin.h +++ b/src/include/gnunet_peerstore_plugin.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_PEERSTORE_PLUGIN_H | 34 | #ifndef GNUNET_PEERSTORE_PLUGIN_H |
35 | #define GNUNET_PEERSTORE_PLUGIN_H | 35 | #define GNUNET_PEERSTORE_PLUGIN_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_peerstore_service.h" | 39 | #include "gnunet_peerstore_service.h" |
39 | 40 | ||
diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h index f9b283a9f..c4000c680 100644 --- a/src/include/gnunet_peerstore_service.h +++ b/src/include/gnunet_peerstore_service.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #ifndef GNUNET_PEERSTORE_SERVICE_H | 36 | #ifndef GNUNET_PEERSTORE_SERVICE_H |
37 | #define GNUNET_PEERSTORE_SERVICE_H | 37 | #define GNUNET_PEERSTORE_SERVICE_H |
38 | 38 | ||
39 | |||
39 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
40 | 41 | ||
41 | #ifdef __cplusplus | 42 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h index d5f3f893a..a3135e2cf 100644 --- a/src/include/gnunet_plugin_lib.h +++ b/src/include/gnunet_plugin_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -44,9 +48,6 @@ extern "C" | |||
44 | #endif | 48 | #endif |
45 | #endif | 49 | #endif |
46 | 50 | ||
47 | #include "gnunet_common.h" | ||
48 | #include "gnunet_configuration_lib.h" | ||
49 | |||
50 | 51 | ||
51 | /** | 52 | /** |
52 | * Signature of any function exported by a plugin. | 53 | * Signature of any function exported by a plugin. |
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index d52c0e40d..4cbc2a139 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef GNUNET_PQ_LIB_H | 25 | #ifndef GNUNET_PQ_LIB_H |
26 | #define GNUNET_PQ_LIB_H | 26 | #define GNUNET_PQ_LIB_H |
27 | 27 | ||
28 | |||
28 | #include <libpq-fe.h> | 29 | #include <libpq-fe.h> |
29 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_db_lib.h" | 31 | #include "gnunet_db_lib.h" |
@@ -147,6 +148,39 @@ GNUNET_PQ_query_param_bool (bool b); | |||
147 | 148 | ||
148 | 149 | ||
149 | /** | 150 | /** |
151 | * Information for an array argument. | ||
152 | */ | ||
153 | struct GNUNET_PQ_ArraySpec | ||
154 | { | ||
155 | /** | ||
156 | * Number of dimensions of the array | ||
157 | */ | ||
158 | unsigned int ndims; | ||
159 | |||
160 | /** | ||
161 | * Array of @e ndims lengths of the array | ||
162 | */ | ||
163 | unsigned int *lens; | ||
164 | |||
165 | /** | ||
166 | * One-dimensional array of pointers to conversion functions for the | ||
167 | * elements in the array. | ||
168 | */ | ||
169 | const struct GNUNET_PQ_QueryParam *ae; | ||
170 | |||
171 | }; | ||
172 | |||
173 | |||
174 | /** | ||
175 | * Generate query parameter for an array. | ||
176 | * | ||
177 | * @param as array specification | ||
178 | */ | ||
179 | struct GNUNET_PQ_QueryParam | ||
180 | GNUNET_PQ_query_param_array (const struct GNUNET_PQ_ArraySpec *as); | ||
181 | |||
182 | |||
183 | /** | ||
150 | * Generate fixed-size query parameter with size determined | 184 | * Generate fixed-size query parameter with size determined |
151 | * by variable type. | 185 | * by variable type. |
152 | * | 186 | * |
@@ -1107,6 +1141,17 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, | |||
1107 | 1141 | ||
1108 | 1142 | ||
1109 | /** | 1143 | /** |
1144 | * Compute the channel that one should notify upon | ||
1145 | * for the given event specification. | ||
1146 | * | ||
1147 | * @param es event specification | ||
1148 | * @return channel to notify upon | ||
1149 | */ | ||
1150 | char * | ||
1151 | GNUNET_PG_get_event_notify_channel (const struct GNUNET_DB_EventHeaderP *es); | ||
1152 | |||
1153 | |||
1154 | /** | ||
1110 | * Within the @a db context, run all the SQL files | 1155 | * Within the @a db context, run all the SQL files |
1111 | * from the @a load_path from 0000-9999.sql (as long | 1156 | * from the @a load_path from 0000-9999.sql (as long |
1112 | * as the files exist contiguously). | 1157 | * as the files exist contiguously). |
diff --git a/src/include/gnunet_program_lib.h b/src/include/gnunet_program_lib.h index 2d4dc626b..0c51d6cf7 100644 --- a/src/include/gnunet_program_lib.h +++ b/src/include/gnunet_program_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -44,6 +48,7 @@ extern "C" | |||
44 | #endif | 48 | #endif |
45 | #endif | 49 | #endif |
46 | 50 | ||
51 | |||
47 | #include "gnunet_configuration_lib.h" | 52 | #include "gnunet_configuration_lib.h" |
48 | #include "gnunet_getopt_lib.h" | 53 | #include "gnunet_getopt_lib.h" |
49 | #include "gnunet_scheduler_lib.h" | 54 | #include "gnunet_scheduler_lib.h" |
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h index 35b58cd0e..e4dec14fa 100644 --- a/src/include/gnunet_reclaim_lib.h +++ b/src/include/gnunet_reclaim_lib.h | |||
@@ -40,6 +40,7 @@ extern "C" { | |||
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | |||
43 | #include "gnunet_util_lib.h" | 44 | #include "gnunet_util_lib.h" |
44 | 45 | ||
45 | enum GNUNET_RECLAIM_AttributeType { | 46 | enum GNUNET_RECLAIM_AttributeType { |
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h index 331f36f24..f8b2084d2 100644 --- a/src/include/gnunet_reclaim_plugin.h +++ b/src/include/gnunet_reclaim_plugin.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #ifndef GNUNET_RECLAIM_PLUGIN_H | 33 | #ifndef GNUNET_RECLAIM_PLUGIN_H |
34 | #define GNUNET_RECLAIM_PLUGIN_H | 34 | #define GNUNET_RECLAIM_PLUGIN_H |
35 | 35 | ||
36 | |||
36 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
37 | #include "gnunet_reclaim_lib.h" | 38 | #include "gnunet_reclaim_lib.h" |
38 | 39 | ||
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index a3f6c19b6..49a006e91 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -41,6 +41,7 @@ extern "C" { | |||
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | |||
44 | #include "gnunet_identity_service.h" | 45 | #include "gnunet_identity_service.h" |
45 | #include "gnunet_reclaim_lib.h" | 46 | #include "gnunet_reclaim_lib.h" |
46 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
diff --git a/src/include/gnunet_regex_service.h b/src/include/gnunet_regex_service.h index b8572156b..093bf2d6a 100644 --- a/src/include/gnunet_regex_service.h +++ b/src/include/gnunet_regex_service.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #ifndef GNUNET_REGEX_SERVICE_H | 39 | #ifndef GNUNET_REGEX_SERVICE_H |
40 | #define GNUNET_REGEX_SERVICE_H | 40 | #define GNUNET_REGEX_SERVICE_H |
41 | 41 | ||
42 | |||
42 | #include "gnunet_util_lib.h" | 43 | #include "gnunet_util_lib.h" |
43 | 44 | ||
44 | #ifdef __cplusplus | 45 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_resolver_service.h b/src/include/gnunet_resolver_service.h index 80c92dc4e..89fec24f5 100644 --- a/src/include/gnunet_resolver_service.h +++ b/src/include/gnunet_resolver_service.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_configuration_lib.h" | 47 | #include "gnunet_configuration_lib.h" |
47 | #include "gnunet_scheduler_lib.h" | 48 | #include "gnunet_scheduler_lib.h" |
48 | #include "gnunet_time_lib.h" | 49 | #include "gnunet_time_lib.h" |
diff --git a/src/include/gnunet_rest_lib.h b/src/include/gnunet_rest_lib.h index 82448697a..f70500de5 100644 --- a/src/include/gnunet_rest_lib.h +++ b/src/include/gnunet_rest_lib.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_REST_LIB_H | 34 | #ifndef GNUNET_REST_LIB_H |
35 | #define GNUNET_REST_LIB_H | 35 | #define GNUNET_REST_LIB_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include <microhttpd.h> | 39 | #include <microhttpd.h> |
39 | 40 | ||
diff --git a/src/include/gnunet_rest_plugin.h b/src/include/gnunet_rest_plugin.h index acfe879b3..45b391ca1 100644 --- a/src/include/gnunet_rest_plugin.h +++ b/src/include/gnunet_rest_plugin.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #ifndef GNUNET_REST_PLUGIN_H | 32 | #ifndef GNUNET_REST_PLUGIN_H |
33 | #define GNUNET_REST_PLUGIN_H | 33 | #define GNUNET_REST_PLUGIN_H |
34 | 34 | ||
35 | |||
35 | #include "gnunet_util_lib.h" | 36 | #include "gnunet_util_lib.h" |
36 | #include "gnunet_rest_lib.h" | 37 | #include "gnunet_rest_lib.h" |
37 | #include "microhttpd.h" | 38 | #include "microhttpd.h" |
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index b3f6a5090..81a90189b 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ | 21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ |
22 | #define GNUNET_REVOCATION_SERVICE_H_ | 22 | #define GNUNET_REVOCATION_SERVICE_H_ |
23 | 23 | ||
24 | |||
24 | #include "gnunet_identity_service.h" | 25 | #include "gnunet_identity_service.h" |
25 | 26 | ||
26 | /** | 27 | /** |
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h index 7f60bb325..96d12db3f 100644 --- a/src/include/gnunet_scalarproduct_service.h +++ b/src/include/gnunet_scalarproduct_service.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #ifndef GNUNET_SCALARPRODUCT_SERVICE_H | 31 | #ifndef GNUNET_SCALARPRODUCT_SERVICE_H |
32 | #define GNUNET_SCALARPRODUCT_SERVICE_H | 32 | #define GNUNET_SCALARPRODUCT_SERVICE_H |
33 | #define GCRYPT_NO_DEPRECATED | 33 | #define GCRYPT_NO_DEPRECATED |
34 | |||
34 | #include <gcrypt.h> | 35 | #include <gcrypt.h> |
35 | 36 | ||
36 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 6492039dd..0118a1535 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -96,6 +96,7 @@ enum GNUNET_SCHEDULER_Reason | |||
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
99 | |||
99 | #include "gnunet_time_lib.h" | 100 | #include "gnunet_time_lib.h" |
100 | #include "gnunet_network_lib.h" | 101 | #include "gnunet_network_lib.h" |
101 | 102 | ||
diff --git a/src/include/gnunet_secretsharing_service.h b/src/include/gnunet_secretsharing_service.h index c13cf482a..de629b308 100644 --- a/src/include/gnunet_secretsharing_service.h +++ b/src/include/gnunet_secretsharing_service.h | |||
@@ -40,6 +40,7 @@ extern "C" | |||
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | |||
43 | #include "gnunet_common.h" | 44 | #include "gnunet_common.h" |
44 | #include "gnunet_time_lib.h" | 45 | #include "gnunet_time_lib.h" |
45 | #include "gnunet_configuration_lib.h" | 46 | #include "gnunet_configuration_lib.h" |
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h index 8c8591af0..7c6ce0c0e 100644 --- a/src/include/gnunet_service_lib.h +++ b/src/include/gnunet_service_lib.h | |||
@@ -18,6 +18,11 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | |||
22 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
23 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
24 | #endif | ||
25 | |||
21 | /** | 26 | /** |
22 | * @addtogroup libgnunetutil | 27 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 28 | * Multi-function utilities library for GNUnet programs |
@@ -50,8 +55,8 @@ extern "C" | |||
50 | #endif | 55 | #endif |
51 | #endif | 56 | #endif |
52 | 57 | ||
58 | #include "gnunet_util_lib.h" | ||
53 | #include "gnunet_configuration_lib.h" | 59 | #include "gnunet_configuration_lib.h" |
54 | #include "gnunet_mq_lib.h" | ||
55 | 60 | ||
56 | 61 | ||
57 | /** | 62 | /** |
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index 255eef265..6874c9ec4 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h | |||
@@ -47,6 +47,7 @@ extern "C" | |||
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | |||
50 | #include "gnunet_common.h" | 51 | #include "gnunet_common.h" |
51 | #include "gnunet_time_lib.h" | 52 | #include "gnunet_time_lib.h" |
52 | #include "gnunet_configuration_lib.h" | 53 | #include "gnunet_configuration_lib.h" |
diff --git a/src/include/gnunet_seti_service.h b/src/include/gnunet_seti_service.h index d2c3b59bb..9125ae825 100644 --- a/src/include/gnunet_seti_service.h +++ b/src/include/gnunet_seti_service.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_common.h" | 48 | #include "gnunet_common.h" |
48 | #include "gnunet_time_lib.h" | 49 | #include "gnunet_time_lib.h" |
49 | #include "gnunet_configuration_lib.h" | 50 | #include "gnunet_configuration_lib.h" |
diff --git a/src/include/gnunet_setu_service.h b/src/include/gnunet_setu_service.h index 89ac3cd07..89a50f138 100644 --- a/src/include/gnunet_setu_service.h +++ b/src/include/gnunet_setu_service.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_common.h" | 48 | #include "gnunet_common.h" |
48 | #include "gnunet_time_lib.h" | 49 | #include "gnunet_time_lib.h" |
49 | #include "gnunet_configuration_lib.h" | 50 | #include "gnunet_configuration_lib.h" |
diff --git a/src/include/gnunet_signal_lib.h b/src/include/gnunet_signal_lib.h index f70f22403..02fbbf005 100644 --- a/src/include/gnunet_signal_lib.h +++ b/src/include/gnunet_signal_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
diff --git a/src/include/gnunet_socks.h b/src/include/gnunet_socks.h index b82943da3..98a27cd1a 100644 --- a/src/include/gnunet_socks.h +++ b/src/include/gnunet_socks.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_common.h" | 47 | #include "gnunet_common.h" |
47 | 48 | ||
48 | 49 | ||
diff --git a/src/include/gnunet_speaker_lib.h b/src/include/gnunet_speaker_lib.h index cb4d65fb9..c6bb128dd 100644 --- a/src/include/gnunet_speaker_lib.h +++ b/src/include/gnunet_speaker_lib.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_util_lib.h" | 48 | #include "gnunet_util_lib.h" |
48 | 49 | ||
49 | /** | 50 | /** |
diff --git a/src/include/gnunet_sq_lib.h b/src/include/gnunet_sq_lib.h index 3406b9031..b84e6759a 100644 --- a/src/include/gnunet_sq_lib.h +++ b/src/include/gnunet_sq_lib.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef GNUNET_SQ_LIB_H | 25 | #ifndef GNUNET_SQ_LIB_H |
26 | #define GNUNET_SQ_LIB_H | 26 | #define GNUNET_SQ_LIB_H |
27 | 27 | ||
28 | |||
28 | #include <sqlite3.h> | 29 | #include <sqlite3.h> |
29 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
30 | 31 | ||
diff --git a/src/include/gnunet_statistics_service.h b/src/include/gnunet_statistics_service.h index a886c6ed8..0fe09e69a 100644 --- a/src/include/gnunet_statistics_service.h +++ b/src/include/gnunet_statistics_service.h | |||
@@ -50,6 +50,7 @@ extern "C" | |||
50 | #endif | 50 | #endif |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | |||
53 | #include "gnunet_util_lib.h" | 54 | #include "gnunet_util_lib.h" |
54 | 55 | ||
55 | /** | 56 | /** |
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 7e06768b8..b751ef044 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup libgnunetutil | 26 | * @addtogroup libgnunetutil |
23 | * Multi-function utilities library for GNUnet programs | 27 | * Multi-function utilities library for GNUnet programs |
@@ -37,6 +41,10 @@ | |||
37 | * @{ | 41 | * @{ |
38 | */ | 42 | */ |
39 | 43 | ||
44 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
45 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
46 | #endif | ||
47 | |||
40 | #ifndef GNUNET_STRINGS_LIB_H | 48 | #ifndef GNUNET_STRINGS_LIB_H |
41 | #define GNUNET_STRINGS_LIB_H | 49 | #define GNUNET_STRINGS_LIB_H |
42 | 50 | ||
@@ -44,6 +52,7 @@ | |||
44 | or unsigned long long, this IS platform dependent; | 52 | or unsigned long long, this IS platform dependent; |
45 | but "stdlib.h" should be portable 'enough' to be | 53 | but "stdlib.h" should be portable 'enough' to be |
46 | unconditionally available... */ | 54 | unconditionally available... */ |
55 | |||
47 | #include <stdlib.h> | 56 | #include <stdlib.h> |
48 | #include <sys/socket.h> | 57 | #include <sys/socket.h> |
49 | #include <netinet/in.h> | 58 | #include <netinet/in.h> |
diff --git a/src/include/gnunet_testbed_logger_service.h b/src/include/gnunet_testbed_logger_service.h index 91ede19d8..7ab943b15 100644 --- a/src/include/gnunet_testbed_logger_service.h +++ b/src/include/gnunet_testbed_logger_service.h | |||
@@ -43,6 +43,7 @@ extern "C" | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
47 | 48 | ||
48 | /** | 49 | /** |
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index ef67ab8ca..acd87e2cd 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #ifndef GNUNET_TESTBED_SERVICE_H | 38 | #ifndef GNUNET_TESTBED_SERVICE_H |
39 | #define GNUNET_TESTBED_SERVICE_H | 39 | #define GNUNET_TESTBED_SERVICE_H |
40 | 40 | ||
41 | |||
41 | #include "gnunet_util_lib.h" | 42 | #include "gnunet_util_lib.h" |
42 | #include "gnunet_testing_lib.h" | 43 | #include "gnunet_testing_lib.h" |
43 | 44 | ||
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 2f64c306b..cd9d88822 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #ifndef GNUNET_TESTING_LIB_H | 44 | #ifndef GNUNET_TESTING_LIB_H |
45 | #define GNUNET_TESTING_LIB_H | 45 | #define GNUNET_TESTING_LIB_H |
46 | 46 | ||
47 | |||
47 | #include "gnunet_util_lib.h" | 48 | #include "gnunet_util_lib.h" |
48 | #include "gnunet_statistics_service.h" | 49 | #include "gnunet_statistics_service.h" |
49 | #include "gnunet_arm_service.h" | 50 | #include "gnunet_arm_service.h" |
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h index 4f52f5af0..8d1295c98 100644 --- a/src/include/gnunet_testing_netjail_lib.h +++ b/src/include/gnunet_testing_netjail_lib.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #ifndef GNUNET_TESTING_NETJAIL_LIB_H | 27 | #ifndef GNUNET_TESTING_NETJAIL_LIB_H |
28 | #define GNUNET_TESTING_NETJAIL_LIB_H | 28 | #define GNUNET_TESTING_NETJAIL_LIB_H |
29 | 29 | ||
30 | |||
30 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_testing_plugin.h" | 32 | #include "gnunet_testing_plugin.h" |
32 | #include "gnunet_testing_ng_lib.h" | 33 | #include "gnunet_testing_ng_lib.h" |
@@ -271,7 +272,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename); | |||
271 | * @return The GNUNET_TESTING_NetjailTopology | 272 | * @return The GNUNET_TESTING_NetjailTopology |
272 | */ | 273 | */ |
273 | struct GNUNET_TESTING_NetjailTopology * | 274 | struct GNUNET_TESTING_NetjailTopology * |
274 | GNUNET_TESTING_get_topo_from_string (char *data); | 275 | GNUNET_TESTING_get_topo_from_string (const char *data); |
275 | 276 | ||
276 | 277 | ||
277 | /** | 278 | /** |
@@ -305,8 +306,8 @@ GNUNET_TESTING_get_node (unsigned int num, | |||
305 | * @return The connections of the node. | 306 | * @return The connections of the node. |
306 | */ | 307 | */ |
307 | struct GNUNET_TESTING_NodeConnection * | 308 | struct GNUNET_TESTING_NodeConnection * |
308 | GNUNET_TESTING_get_connections (unsigned int num, struct | 309 | GNUNET_TESTING_get_connections (unsigned int num, |
309 | GNUNET_TESTING_NetjailTopology *topology); | 310 | const struct GNUNET_TESTING_NetjailTopology *topology); |
310 | 311 | ||
311 | 312 | ||
312 | /** | 313 | /** |
@@ -318,7 +319,7 @@ GNUNET_TESTING_get_connections (unsigned int num, struct | |||
318 | */ | 319 | */ |
319 | char * | 320 | char * |
320 | GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, | 321 | GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, |
321 | char *prefix); | 322 | const char *prefix); |
322 | 323 | ||
323 | 324 | ||
324 | /** | 325 | /** |
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 9a6c82d90..db89e1a8e 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #ifndef GNUNET_TESTING_NG_LIB_H | 27 | #ifndef GNUNET_TESTING_NG_LIB_H |
28 | #define GNUNET_TESTING_NG_LIB_H | 28 | #define GNUNET_TESTING_NG_LIB_H |
29 | 29 | ||
30 | |||
30 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_testing_plugin.h" | 32 | #include "gnunet_testing_plugin.h" |
32 | #include "gnunet_testing_lib.h" | 33 | #include "gnunet_testing_lib.h" |
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index e66ce6ea9..308aadb53 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -44,6 +44,7 @@ extern "C" | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | |||
47 | #include "gnunet_common.h" | 48 | #include "gnunet_common.h" |
48 | 49 | ||
49 | /** | 50 | /** |
diff --git a/src/include/gnunet_transport_application_service.h b/src/include/gnunet_transport_application_service.h index 9a6ddd36a..6ec1aa578 100644 --- a/src/include/gnunet_transport_application_service.h +++ b/src/include/gnunet_transport_application_service.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H | 33 | #ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H |
34 | #define GNUNET_TRANSPORT_APPLICATION_SERVICE_H | 34 | #define GNUNET_TRANSPORT_APPLICATION_SERVICE_H |
35 | 35 | ||
36 | |||
36 | #include "gnunet_constants.h" | 37 | #include "gnunet_constants.h" |
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_nt_lib.h" | 39 | #include "gnunet_nt_lib.h" |
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h index 6c99de78e..b523f1536 100644 --- a/src/include/gnunet_transport_communication_service.h +++ b/src/include/gnunet_transport_communication_service.h | |||
@@ -45,6 +45,7 @@ extern "C" { | |||
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | |||
48 | #include "gnunet_util_lib.h" | 49 | #include "gnunet_util_lib.h" |
49 | #include "gnunet_nt_lib.h" | 50 | #include "gnunet_nt_lib.h" |
50 | 51 | ||
diff --git a/src/include/gnunet_transport_core_service.h b/src/include/gnunet_transport_core_service.h index fc8272892..9153161d3 100644 --- a/src/include/gnunet_transport_core_service.h +++ b/src/include/gnunet_transport_core_service.h | |||
@@ -43,6 +43,7 @@ extern "C" { | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | |||
46 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
47 | 48 | ||
48 | /** | 49 | /** |
diff --git a/src/include/gnunet_transport_hello_service.h b/src/include/gnunet_transport_hello_service.h index 6f737de23..03305ec27 100644 --- a/src/include/gnunet_transport_hello_service.h +++ b/src/include/gnunet_transport_hello_service.h | |||
@@ -46,6 +46,7 @@ extern "C" { | |||
46 | #endif | 46 | #endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | |||
49 | #include "gnunet_util_lib.h" | 50 | #include "gnunet_util_lib.h" |
50 | #include "gnunet_ats_service.h" | 51 | #include "gnunet_ats_service.h" |
51 | 52 | ||
diff --git a/src/include/gnunet_transport_manipulation_service.h b/src/include/gnunet_transport_manipulation_service.h index b77735a61..694ca7dca 100644 --- a/src/include/gnunet_transport_manipulation_service.h +++ b/src/include/gnunet_transport_manipulation_service.h | |||
@@ -47,6 +47,7 @@ extern "C" | |||
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | |||
50 | #include "gnunet_util_lib.h" | 51 | #include "gnunet_util_lib.h" |
51 | #include "gnunet_ats_service.h" | 52 | #include "gnunet_ats_service.h" |
52 | 53 | ||
diff --git a/src/include/gnunet_transport_monitor_service.h b/src/include/gnunet_transport_monitor_service.h index c3d98ff53..acf7ade69 100644 --- a/src/include/gnunet_transport_monitor_service.h +++ b/src/include/gnunet_transport_monitor_service.h | |||
@@ -45,6 +45,7 @@ extern "C" | |||
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | |||
48 | #include "gnunet_util_lib.h" | 49 | #include "gnunet_util_lib.h" |
49 | #include "gnunet_ats_transport_service.h" | 50 | #include "gnunet_ats_transport_service.h" |
50 | #include "gnunet_transport_communication_service.h" | 51 | #include "gnunet_transport_communication_service.h" |
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h index 3c857a34c..0ab4a995c 100644 --- a/src/include/gnunet_transport_plugin.h +++ b/src/include/gnunet_transport_plugin.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #ifndef PLUGIN_TRANSPORT_H | 39 | #ifndef PLUGIN_TRANSPORT_H |
40 | #define PLUGIN_TRANSPORT_H | 40 | #define PLUGIN_TRANSPORT_H |
41 | 41 | ||
42 | |||
42 | #include "gnunet_configuration_lib.h" | 43 | #include "gnunet_configuration_lib.h" |
43 | #include "gnunet_scheduler_lib.h" | 44 | #include "gnunet_scheduler_lib.h" |
44 | #include "gnunet_statistics_service.h" | 45 | #include "gnunet_statistics_service.h" |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index daa79bf1c..72cdbe0a7 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -45,6 +45,7 @@ extern "C" { | |||
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | |||
48 | #include "gnunet_util_lib.h" | 49 | #include "gnunet_util_lib.h" |
49 | #include "gnunet_ats_service.h" | 50 | #include "gnunet_ats_service.h" |
50 | 51 | ||
diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index e92d6ae04..17acfe5f8 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h | |||
@@ -18,6 +18,10 @@ | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) | ||
22 | #error "Only <gnunet_util_lib.h> can be included directly." | ||
23 | #endif | ||
24 | |||
21 | /** | 25 | /** |
22 | * @addtogroup vpn_suite VPN services and libraries | 26 | * @addtogroup vpn_suite VPN services and libraries |
23 | * @{ | 27 | * @{ |
@@ -37,9 +41,6 @@ | |||
37 | #ifndef GNUNET_TUN_LIB_H | 41 | #ifndef GNUNET_TUN_LIB_H |
38 | #define GNUNET_TUN_LIB_H | 42 | #define GNUNET_TUN_LIB_H |
39 | 43 | ||
40 | #include "gnunet_common.h" | ||
41 | #include "gnunet_crypto_lib.h" | ||
42 | |||
43 | 44 | ||
44 | /* see http://www.iana.org/assignments/ethernet-numbers */ | 45 | /* see http://www.iana.org/assignments/ethernet-numbers */ |
45 | #ifndef ETH_P_IPV4 | 46 | #ifndef ETH_P_IPV4 |
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h index ee362f789..ada40a4ca 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -30,6 +30,10 @@ | |||
30 | #ifndef GNUNET_UTIL_LIB_H | 30 | #ifndef GNUNET_UTIL_LIB_H |
31 | #define GNUNET_UTIL_LIB_H | 31 | #define GNUNET_UTIL_LIB_H |
32 | 32 | ||
33 | #define __GNUNET_UTIL_LIB_H_INSIDE__ | ||
34 | |||
35 | #include <sys/socket.h> | ||
36 | |||
33 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
34 | extern "C" | 38 | extern "C" |
35 | { | 39 | { |
@@ -59,9 +63,10 @@ extern "C" | |||
59 | * this service available to anyone but yourself. | 63 | * this service available to anyone but yourself. |
60 | */ | 64 | */ |
61 | #define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \ | 65 | #define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \ |
62 | PACKAGE_VERSION | 66 | GNUNET_VERSION |
63 | |||
64 | 67 | ||
68 | #include "gnunet_config.h" | ||
69 | #include "gnunet_common.h" | ||
65 | #include "gnunet_crypto_lib.h" | 70 | #include "gnunet_crypto_lib.h" |
66 | #include "gnunet_bandwidth_lib.h" | 71 | #include "gnunet_bandwidth_lib.h" |
67 | #include "gnunet_bio_lib.h" | 72 | #include "gnunet_bio_lib.h" |
@@ -88,6 +93,43 @@ extern "C" | |||
88 | #include "gnunet_child_management_lib.h" | 93 | #include "gnunet_child_management_lib.h" |
89 | #include "gnunet_error_codes.h" | 94 | #include "gnunet_error_codes.h" |
90 | 95 | ||
96 | /** | ||
97 | * Try to compress the given block of data using libz. Only returns | ||
98 | * the compressed block if compression worked and the new block is | ||
99 | * actually smaller. Decompress using #GNUNET_decompress(). | ||
100 | * | ||
101 | * @param data block to compress; if compression | ||
102 | * resulted in a smaller block, the first | ||
103 | * bytes of data are updated to the compressed | ||
104 | * data | ||
105 | * @param old_size number of bytes in data | ||
106 | * @param[out] result set to the compressed data, if compression worked | ||
107 | * @param[out] new_size set to size of result, if compression worked | ||
108 | * @return #GNUNET_YES if compression reduce the size, | ||
109 | * #GNUNET_NO if compression did not help | ||
110 | */ | ||
111 | int | ||
112 | GNUNET_try_compression (const char *data, | ||
113 | size_t old_size, | ||
114 | char **result, | ||
115 | size_t *new_size); | ||
116 | |||
117 | /** | ||
118 | * Decompress input, return the decompressed data as output. Dual to | ||
119 | * #GNUNET_try_compression(). Caller must set @a output_size to the | ||
120 | * number of bytes that were originally compressed. | ||
121 | * | ||
122 | * @param input compressed data | ||
123 | * @param input_size number of bytes in input | ||
124 | * @param output_size expected size of the output | ||
125 | * @return NULL on error, buffer of @a output_size decompressed bytes otherwise | ||
126 | */ | ||
127 | char * | ||
128 | GNUNET_decompress (const char *input, | ||
129 | size_t input_size, | ||
130 | size_t output_size); | ||
131 | |||
132 | |||
91 | #if 0 /* keep Emacsens' auto-indent happy */ | 133 | #if 0 /* keep Emacsens' auto-indent happy */ |
92 | { | 134 | { |
93 | #endif | 135 | #endif |
@@ -95,4 +137,6 @@ extern "C" | |||
95 | } | 137 | } |
96 | #endif | 138 | #endif |
97 | 139 | ||
140 | #undef __GNUNET_UTIL_LIB_H_INSIDE__ | ||
141 | |||
98 | #endif | 142 | #endif |
diff --git a/src/include/gnunet_vpn_service.h b/src/include/gnunet_vpn_service.h index d493dddd0..f0a04ae1b 100644 --- a/src/include/gnunet_vpn_service.h +++ b/src/include/gnunet_vpn_service.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifndef GNUNET_VPN_SERVICE_H | 34 | #ifndef GNUNET_VPN_SERVICE_H |
35 | #define GNUNET_VPN_SERVICE_H | 35 | #define GNUNET_VPN_SERVICE_H |
36 | 36 | ||
37 | |||
37 | #include "gnunet_util_lib.h" | 38 | #include "gnunet_util_lib.h" |
38 | 39 | ||
39 | 40 | ||
diff --git a/src/include/platform.h b/src/include/platform.h index e44f9f51a..deca323d1 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -34,7 +34,7 @@ | |||
34 | #ifndef HAVE_USED_CONFIG_H | 34 | #ifndef HAVE_USED_CONFIG_H |
35 | #define HAVE_USED_CONFIG_H | 35 | #define HAVE_USED_CONFIG_H |
36 | #if HAVE_CONFIG_H | 36 | #if HAVE_CONFIG_H |
37 | #include "gnunet_config.h" | 37 | #include "gnunet_private_config.h" |
38 | #endif | 38 | #endif |
39 | #endif | 39 | #endif |
40 | 40 | ||