aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-05 13:15:09 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-05 13:15:09 +0900
commit6ccf51adc80cdb818416971cfd8ba82084571299 (patch)
tree969e4715caf2057613a96f175302c16a0c7c7206 /src/include
parent8fd3a06ccdee5319d9a3b6d42201e879375bbb2a (diff)
downloadgnunet-6ccf51adc80cdb818416971cfd8ba82084571299.tar.gz
gnunet-6ccf51adc80cdb818416971cfd8ba82084571299.zip
BUILD: Improve extractor handling. Removed platform.h from include
Extractor is not properly detected and GNUNET_FS_EXTRACTOR_ENABLED added to gnunet_config.h. platform.h is removed from $PREFIX/include as it must not be included by third parties anyway.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/gnunet_config.h.in7
-rw-r--r--src/include/gnunet_extractor_compat.h149
-rw-r--r--src/include/gnunet_fs_service.h100
-rw-r--r--src/include/gnunet_util_lib.h1
5 files changed, 109 insertions, 151 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 6ece35851..4a0429900 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -4,13 +4,13 @@ SUBDIRS = .
4gnunetincludedir = $(includedir)/gnunet 4gnunetincludedir = $(includedir)/gnunet
5 5
6EXTRA_DIST = \ 6EXTRA_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
12gnunetinclude_HEADERS = \ 13gnunetinclude_HEADERS = \
13 platform.h \
14 gnunet_config.h \ 14 gnunet_config.h \
15 gettext.h \ 15 gettext.h \
16 compat.h \ 16 compat.h \
@@ -51,7 +51,6 @@ gnunetinclude_HEADERS = \
51 gnunet_dnsstub_lib.h \ 51 gnunet_dnsstub_lib.h \
52 gnunet_dns_service.h \ 52 gnunet_dns_service.h \
53 gnunet_error_codes.h \ 53 gnunet_error_codes.h \
54 gnunet_extractor_compat.h \
55 gnunet_fragmentation_lib.h \ 54 gnunet_fragmentation_lib.h \
56 gnunet_friends_lib.h \ 55 gnunet_friends_lib.h \
57 gnunet_fs_service.h \ 56 gnunet_fs_service.h \
diff --git a/src/include/gnunet_config.h.in b/src/include/gnunet_config.h.in
index ce7c5a894..63ffd84bd 100644
--- a/src/include/gnunet_config.h.in
+++ b/src/include/gnunet_config.h.in
@@ -48,4 +48,11 @@
48/* Set to 1 if GnuTLS has DANE support */ 48/* Set to 1 if GnuTLS has DANE support */
49#define GNUNET_CURL_GNUTLS @curl_gnutls@ 49#define GNUNET_CURL_GNUTLS @curl_gnutls@
50 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
51#endif 58#endif
diff --git a/src/include/gnunet_extractor_compat.h b/src/include/gnunet_extractor_compat.h
deleted file mode 100644
index d69525c9d..000000000
--- a/src/include/gnunet_extractor_compat.h
+++ /dev/null
@@ -1,149 +0,0 @@
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 * libextractor compatibility insanity helper header
25 *
26 * @{
27 */
28#ifndef GNUNET_EXTRACTOR_COMPAT_H
29#define GNUNET_EXTRACTOR_COMPAT_H
30
31
32#ifdef __cplusplus
33extern "C"
34{
35#if 0 /* keep Emacsens' auto-indent happy */
36}
37#endif
38#endif
39
40#if HAVE_EXTRACTOR_H
41
42#include <extractor.h>
43
44#else
45
46/* definitions from extractor.h we need for the build */
47
48/**
49 * Enumeration defining various sources of keywords. See also
50 * http://dublincore.org/documents/1998/09/dces/
51 */
52enum EXTRACTOR_MetaType
53{
54 EXTRACTOR_METATYPE_RESERVED = 0,
55 EXTRACTOR_METATYPE_MIMETYPE = 1,
56 EXTRACTOR_METATYPE_FILENAME = 2,
57 EXTRACTOR_METATYPE_COMMENT = 3,
58 EXTRACTOR_METATYPE_TITLE = 4,
59 EXTRACTOR_METATYPE_BOOK_TITLE = 5,
60 EXTRACTOR_METATYPE_JOURNAL_NAME = 8,
61 EXTRACTOR_METATYPE_AUTHOR_NAME = 13,
62 EXTRACTOR_METATYPE_PUBLICATION_DATE = 24,
63 EXTRACTOR_METATYPE_URL = 29,
64 EXTRACTOR_METATYPE_URI = 30,
65 EXTRACTOR_METATYPE_ISRC = 31,
66 EXTRACTOR_METATYPE_UNKNOWN = 45,
67 EXTRACTOR_METATYPE_DESCRIPTION = 46,
68 EXTRACTOR_METATYPE_KEYWORDS = 49,
69 EXTRACTOR_METATYPE_SUBJECT = 52,
70 EXTRACTOR_METATYPE_PACKAGE_NAME = 69,
71 EXTRACTOR_METATYPE_THUMBNAIL = 114,
72 EXTRACTOR_METATYPE_ALBUM = 129,
73 EXTRACTOR_METATYPE_ARTIST = 130,
74 EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162,
75 EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174,
76 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180,
77};
78
79/**
80 * Format in which the extracted meta data is presented.
81 */
82enum EXTRACTOR_MetaFormat
83{
84 /**
85 * Format is unknown.
86 */
87 EXTRACTOR_METAFORMAT_UNKNOWN = 0,
88
89 /**
90 * 0-terminated, UTF-8 encoded string. "data_len"
91 * is strlen(data)+1.
92 */
93 EXTRACTOR_METAFORMAT_UTF8 = 1,
94
95 /**
96 * Some kind of binary format, see given Mime type.
97 */
98 EXTRACTOR_METAFORMAT_BINARY = 2,
99
100 /**
101 * 0-terminated string. The specific encoding is unknown.
102 * "data_len" is strlen (data)+1.
103 */
104 EXTRACTOR_METAFORMAT_C_STRING = 3
105};
106
107
108/**
109 * Type of a function that libextractor calls for each
110 * meta data item found.
111 *
112 * @param cls closure (user-defined)
113 * @param plugin_name name of the plugin that produced this value;
114 * special values can be used (e.g. '&lt;zlib&gt;' for zlib being
115 * used in the main libextractor library and yielding
116 * meta data).
117 * @param type libextractor-type describing the meta data
118 * @param format basic format information about @a data
119 * @param data_mime_type mime-type of @a data (not of the original file);
120 * can be NULL (if mime-type is not known)
121 * @param data actual meta-data found
122 * @param data_len number of bytes in @a data
123 * @return 0 to continue extracting, 1 to abort
124 */
125typedef int (*EXTRACTOR_MetaDataProcessor) (void *cls,
126 const char *plugin_name,
127 enum EXTRACTOR_MetaType type,
128 enum EXTRACTOR_MetaFormat format,
129 const char *data_mime_type,
130 const char *data,
131 size_t data_len);
132
133#endif
134
135#ifndef EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME
136/* hack for LE < 0.6.3 */
137#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180
138#endif
139
140#if 0 /* keep Emacsens' auto-indent happy */
141{
142#endif
143#ifdef __cplusplus
144}
145#endif
146
147#endif
148
149/** @} */ /* end of group */
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index 53ca6a9ec..5c271c71f 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -71,6 +71,106 @@ extern "C"
71 */ 71 */
72#define GNUNET_FS_VERSION 0x00090300 72#define GNUNET_FS_VERSION 0x00090300
73 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 */
86enum 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 */
116enum 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. '&lt;zlib&gt;' 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 */
159typedef 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
74 174
75/* ******************** URI API *********************** */ 175/* ******************** URI API *********************** */
76 176
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index 280304825..ada40a4ca 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -65,6 +65,7 @@ extern "C"
65#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" \
66 GNUNET_VERSION 66 GNUNET_VERSION
67 67
68#include "gnunet_config.h"
68#include "gnunet_common.h" 69#include "gnunet_common.h"
69#include "gnunet_crypto_lib.h" 70#include "gnunet_crypto_lib.h"
70#include "gnunet_bandwidth_lib.h" 71#include "gnunet_bandwidth_lib.h"