From adc2b226adbb0ed96f73777b2145202dcb9a530f Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Wed, 8 Jan 2020 20:11:23 -0600 Subject: Update gnunet to commit e8533c But it's not building for me due to a compiler error. --- gnunet-build/packages/gnunet/gnunet/Buildrules | 2 +- .../gnunet/files/gnunet-git-4ac7b3-all.patch | 1039 ------------------- .../gnunet/files/gnunet-git-e8533c-all.patch | 1056 ++++++++++++++++++++ .../plugin_transport_http_client_emscripten.c | 14 +- .../gnunet/gnunet/files/plugin_transport_webrtc.c | 9 +- 5 files changed, 1068 insertions(+), 1052 deletions(-) delete mode 100644 gnunet-build/packages/gnunet/gnunet/files/gnunet-git-4ac7b3-all.patch create mode 100644 gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch diff --git a/gnunet-build/packages/gnunet/gnunet/Buildrules b/gnunet-build/packages/gnunet/gnunet/Buildrules index 754a362..b8423d4 100644 --- a/gnunet-build/packages/gnunet/gnunet/Buildrules +++ b/gnunet-build/packages/gnunet/gnunet/Buildrules @@ -1,4 +1,4 @@ -COMMIT="4ac7b3" +COMMIT="e8533c" VERSION="git-${COMMIT}" RELEASE="0" DESCRIPTION="GNUnet is a framework for secure peer-to-peer networking that does not use any centralized or otherwise trusted services." diff --git a/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-4ac7b3-all.patch b/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-4ac7b3-all.patch deleted file mode 100644 index 2adb46c..0000000 --- a/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-4ac7b3-all.patch +++ /dev/null @@ -1,1039 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 804a7dd56..44881b985 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -811,7 +811,7 @@ AC_ARG_WITH(ltdl, - AC_CHECK_HEADERS(ltdl.h, - AC_CHECK_LIB([ltdl], [lt_dlopenext], - ltdl=1))]) --if test x$ltdl = x1 -+if true - then - AC_MSG_RESULT([libltdl found]) - else -diff --git a/src/Makefile.am b/src/Makefile.am -index 39cbaa893..05370e160 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -80,7 +80,6 @@ else - SUBDIRS = \ - include $(INTLEMU_SUBDIRS) \ - util \ -- gnsrecord \ - hello \ - block \ - statistics \ -@@ -105,30 +104,20 @@ SUBDIRS = \ - $(ATS_TESTS) \ - nse \ - dht \ -- hostlist \ - topology \ - regex \ - dns \ - identity \ -- namecache \ -- namestore \ - peerstore \ - cadet \ - set \ - consensus \ - scalarproduct \ - revocation \ -- vpn \ -- gns \ -- zonemaster \ - $(CONVERSATION_DIR) \ - fs \ -- exit \ -- pt \ -- secretsharing \ - $(EXP_DIR) \ - $(JSON_DIR) \ -- $(REST_DIR) \ -- integration-tests -+ $(REST_DIR) - - endif -diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am -index 240abbc67..db784cc44 100644 ---- a/src/datastore/Makefile.am -+++ b/src/datastore/Makefile.am -@@ -104,7 +104,8 @@ plugin_LTLIBRARIES = \ - $(SQLITE_PLUGIN) \ - $(MYSQL_PLUGIN) \ - $(POSTGRES_PLUGIN) \ -- libgnunet_plugin_datastore_heap.la -+ libgnunet_plugin_datastore_heap.la \ -+ libgnunet_plugin_datastore_emscripten.la - - # Real plugins should of course go into - # plugin_LTLIBRARIES -@@ -131,6 +132,13 @@ libgnunet_plugin_datastore_heap_la_LIBADD = \ - libgnunet_plugin_datastore_heap_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) - -+libgnunet_plugin_datastore_emscripten_la_SOURCES = \ -+ plugin_datastore_emscripten.c -+libgnunet_plugin_datastore_emscripten_la_LIBADD = \ -+ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ -+ $(LTLIBINTL) -+libgnunet_plugin_datastore_emscripten_la_LDFLAGS = \ -+ $(GN_PLUGIN_LDFLAGS) - - libgnunet_plugin_datastore_mysql_la_SOURCES = \ - plugin_datastore_mysql.c -diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am -index c52ac93c7..d3983ef9e 100644 ---- a/src/dht/Makefile.am -+++ b/src/dht/Makefile.am -@@ -50,15 +50,6 @@ libgnunet_plugin_block_dht_la_LDFLAGS = \ - libexec_PROGRAMS = \ - gnunet-service-dht - --bin_PROGRAMS = \ -- gnunet-dht-monitor \ -- gnunet-dht-get \ -- gnunet-dht-put -- --if HAVE_TESTING --noinst_PROGRAMS = \ -- gnunet-dht-profiler --endif - - gnunet_service_dht_SOURCES = \ - gnunet-service-dht.c gnunet-service-dht.h \ -diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am -index ca2685765..07eb794ca 100644 ---- a/src/dns/Makefile.am -+++ b/src/dns/Makefile.am -@@ -18,14 +18,6 @@ plugindir = $(libdir)/gnunet - pkgcfg_DATA = \ - dns.conf - --if LINUX --HIJACKBIN = gnunet-helper-dns --install-exec-hook: -- $(top_srcdir)/src/dns/install-dns-helper.sh $(DESTDIR)$(libexecdir) $(GNUNETDNS_GROUP) $(SUDO_BINARY) || true --else --install-exec-hook: --endif -- - lib_LTLIBRARIES = \ - libgnunetdns.la - -diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c -index 9b783ba93..f4aa012b1 100644 ---- a/src/fs/fs_api.c -+++ b/src/fs/fs_api.c -@@ -454,19 +454,22 @@ struct FileInfo - * to provide less data unless there is an error; - * a value of "0" will be used at the end to allow - * the reader to clean up its internal state -- * @param buf where the reader should write the data -- * @param emsg location for the reader to store an error message -- * @return number of bytes written, usually @a max, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --size_t -+int - GNUNET_FS_data_reader_file_ (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg) -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls) - { - struct FileInfo *fi = cls; - ssize_t ret; -+ char **emsg = NULL; -+ char buf[max]; - - if (UINT64_MAX == offset) - { -@@ -475,7 +478,7 @@ GNUNET_FS_data_reader_file_ (void *cls, - GNUNET_DISK_file_close (fi->fd); - fi->fd = NULL; - } -- return 0; -+ return GNUNET_SYSERR; - } - if (0 == max) - { -@@ -483,7 +486,7 @@ GNUNET_FS_data_reader_file_ (void *cls, - GNUNET_DISK_file_close (fi->fd); - GNUNET_free (fi->filename); - GNUNET_free (fi); -- return 0; -+ return GNUNET_SYSERR; - } - if (NULL == fi->fd) - { -@@ -497,7 +500,9 @@ GNUNET_FS_data_reader_file_ (void *cls, - _("Could not open file `%s': %s"), - fi->filename, - STRERROR (errno)); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, *emsg); -+ return GNUNET_OK; - } - } - if ( (GNUNET_SYSERR == -@@ -508,16 +513,22 @@ GNUNET_FS_data_reader_file_ (void *cls, - _("Could not read file `%s': %s"), - fi->filename, - STRERROR (errno)); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, *emsg); -+ return GNUNET_OK; - } - if (ret != max) - { - GNUNET_asprintf (emsg, - _("Short read reading from file `%s'!"), - fi->filename); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, *emsg); -+ return GNUNET_OK; - } -- return max; -+ if (cont) -+ cont (cont_cls, buf, max, NULL); -+ return GNUNET_OK; - } - - -@@ -559,28 +570,30 @@ GNUNET_FS_make_file_reader_context_ (const char *filename) - * to provide less data unless there is an error; - * a value of "0" will be used at the end to allow - * the reader to clean up its internal state -- * @param buf where the reader should write the data -- * @param emsg location for the reader to store an error message -- * @return number of bytes written, usually @a max, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --size_t -+int - GNUNET_FS_data_reader_copy_ (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg) -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls) - { - char *data = cls; - - if (UINT64_MAX == offset) -- return 0; -+ return GNUNET_SYSERR; - if (0 == max) - { - GNUNET_free_non_null (data); -- return 0; -+ return GNUNET_SYSERR; - } -- GNUNET_memcpy (buf, &data[offset], max); -- return max; -+ if (cont) -+ cont (cont_cls, &data[offset], max, NULL); -+ return GNUNET_OK; - } - - -@@ -1248,43 +1261,6 @@ make_serialization_file_name_in_dir (struct GNUNET_FS_Handle *h, - - - /** -- * Copy all of the data from the reader to the write handle. -- * -- * @param wh write handle -- * @param fi file with reader -- * @return #GNUNET_OK on success -- */ --static int --copy_from_reader (struct GNUNET_BIO_WriteHandle *wh, -- struct GNUNET_FS_FileInformation *fi) --{ -- char buf[32 * 1024]; -- uint64_t off; -- size_t ret; -- size_t left; -- char *emsg; -- -- emsg = NULL; -- off = 0; -- while (off < fi->data.file.file_size) -- { -- left = GNUNET_MIN (sizeof (buf), fi->data.file.file_size - off); -- ret = -- fi->data.file.reader (fi->data.file.reader_cls, off, left, buf, &emsg); -- if (0 == ret) -- { -- GNUNET_free (emsg); -- return GNUNET_SYSERR; -- } -- if (GNUNET_OK != GNUNET_BIO_write (wh, buf, ret)) -- return GNUNET_SYSERR; -- off += ret; -- } -- return GNUNET_OK; --} -- -- --/** - * Create a temporary file on disk to store the current - * state of @a fi in. - * -@@ -1368,7 +1344,6 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) - goto cleanup; - } - if ((GNUNET_NO == fi->is_published) && (NULL == fi->filename)) -- if (GNUNET_OK != copy_from_reader (wh, fi)) - { - GNUNET_break (0); - goto cleanup; -diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h -index 35a3c6837..ac1332f57 100644 ---- a/src/fs/fs_api.h -+++ b/src/fs/fs_api.h -@@ -668,16 +668,17 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe); - * to provide less data unless there is an error; - * a value of "0" will be used at the end to allow - * the reader to clean up its internal state -- * @param buf where the reader should write the data -- * @param emsg location for the reader to store an error message -- * @return number of bytes written, usually "max", 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --size_t -+int - GNUNET_FS_data_reader_file_ (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg); -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls); - - - /** -@@ -703,16 +704,17 @@ GNUNET_FS_make_file_reader_context_ (const char *filename); - * to provide less data unless there is an error; - * a value of "0" will be used at the end to allow - * the reader to clean up its internal state -- * @param buf where the reader should write the data -- * @param emsg location for the reader to store an error message -- * @return number of bytes written, usually @a max, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --size_t -+int - GNUNET_FS_data_reader_copy_ (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg); -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls); - - - /** -diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c -index b32e9ddde..631b01986 100644 ---- a/src/fs/fs_download.c -+++ b/src/fs/fs_download.c -@@ -1760,33 +1760,36 @@ reconstruct_cb (void *cls, - * @param offset identifies which block to get - * @param max (maximum) number of bytes to get; returning - * fewer will also cause errors -- * @param buf where to copy the plaintext buffer -- * @param emsg location to store an error message (on error) -- * @return number of bytes copied to buf, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --static size_t --fh_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) -+static int -+fh_reader (void *cls, uint64_t offset, size_t max, -+ GNUNET_FS_ReaderContinuation cont, void *cont_cls) - { - struct GNUNET_FS_DownloadContext *dc = cls; - struct GNUNET_DISK_FileHandle *fh = dc->rfh; - ssize_t ret; -+ char buf[max]; - -- if (NULL != emsg) -- *emsg = NULL; - if (offset != GNUNET_DISK_file_seek (fh, offset, GNUNET_DISK_SEEK_SET)) - { -- if (NULL != emsg) -- *emsg = GNUNET_strdup (strerror (errno)); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, GNUNET_strdup (strerror (errno))); -+ return GNUNET_OK; - } - ret = GNUNET_DISK_file_read (fh, buf, max); - if (ret < 0) - { -- if (NULL != emsg) -- *emsg = GNUNET_strdup (strerror (errno)); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, GNUNET_strdup (strerror (errno))); -+ return GNUNET_OK; - } -- return ret; -+ if (cont) -+ cont (cont_cls, buf, max, NULL); -+ return GNUNET_OK; - } - - -diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c -index 2bb7c5750..82039b15c 100644 ---- a/src/fs/fs_publish.c -+++ b/src/fs/fs_publish.c -@@ -361,24 +361,24 @@ publish_kblocks_cont (void *cls, - * @param emsg location to store an error message (on error) - * @return number of bytes copied to buf, 0 on error - */ --static size_t -+static int - block_reader (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg) -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls) - { - struct GNUNET_FS_PublishContext *pc = cls; - struct GNUNET_FS_FileInformation *p; - const char *dd; -- size_t pt_size; - - p = pc->fi_pos; - if (GNUNET_YES == p->is_directory) - { -- pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); - dd = p->data.dir.dir_data; -- GNUNET_memcpy (buf, &dd[offset], pt_size); -+ if (cont) -+ cont (cont_cls, &dd[offset], max, NULL); -+ return GNUNET_OK; - } - else - { -@@ -389,18 +389,11 @@ block_reader (void *cls, - /* force closing the file to avoid keeping too many files open */ - p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); - } -- return 0; -+ return GNUNET_SYSERR; /* return value ignored in this case */ - } -- pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); -- if (0 == pt_size) -- return 0; /* calling reader with pt_size==0 -- * might free buf, so don't! */ -- if (pt_size != -- p->data.file.reader (p->data.file.reader_cls, offset, pt_size, buf, -- emsg)) -- return 0; -- } -- return pt_size; -+ return p->data.file.reader (p->data.file.reader_cls, offset, max, -+ cont, cont_cls); -+ } - } - - -@@ -608,7 +601,6 @@ static void - publish_content (struct GNUNET_FS_PublishContext *pc) - { - struct GNUNET_FS_FileInformation *p; -- char *emsg; - struct GNUNET_FS_DirectoryBuilder *db; - struct GNUNET_FS_FileInformation *dirpos; - void *raw_data; -@@ -633,22 +625,6 @@ publish_content (struct GNUNET_FS_PublishContext *pc) - else - { - raw_data = NULL; -- if ((dirpos->data.file.file_size < MAX_INLINE_SIZE) && -- (dirpos->data.file.file_size > 0)) -- { -- raw_data = GNUNET_malloc (dirpos->data.file.file_size); -- emsg = NULL; -- if (dirpos->data.file.file_size != -- dirpos->data.file.reader (dirpos->data.file.reader_cls, 0, -- dirpos->data.file.file_size, raw_data, -- &emsg)) -- { -- GNUNET_free_non_null (emsg); -- GNUNET_free (raw_data); -- raw_data = NULL; -- } -- dirpos->data.file.reader (dirpos->data.file.reader_cls, UINT64_MAX, 0, 0, NULL); -- } - } - GNUNET_FS_directory_builder_add (db, dirpos->chk_uri, dirpos->meta, - raw_data); -diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c -index f8ed3a22f..2b7678503 100644 ---- a/src/fs/fs_test_lib.c -+++ b/src/fs/fs_test_lib.c -@@ -271,26 +271,23 @@ publish_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) - * @param cls pointer to uint32_t with publishing seed - * @param offset offset to generate data for - * @param max maximum number of bytes to generate -- * @param buf where to write generated data -- * @param emsg where to store error message (unused) -- * @return number of bytes written to buf -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --static size_t -+static int - file_generator (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg) -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls) - { - uint32_t *publish_seed = cls; - uint64_t pos; -- uint8_t *cbuf = buf; -+ uint8_t cbuf[max]; - int mod; - -- if (emsg != NULL) -- *emsg = NULL; -- if (buf == NULL) -- return 0; - for (pos = 0; pos < 8; pos++) - cbuf[pos] = (uint8_t) (offset >> pos * 8); - for (pos = 8; pos < max; pos++) -@@ -300,7 +297,9 @@ file_generator (void *cls, - mod = 1; - cbuf[pos] = (uint8_t) ((offset * (*publish_seed)) % mod); - } -- return max; -+ if (cont) -+ cont (cont_cls, cbuf, max, NULL); -+ return GNUNET_OK; - } - - -@@ -344,6 +343,24 @@ fs_disconnect_adapter (void *cls, - - - /** -+ * Continuation for GNUNET_FS_DataReader -+ */ -+static void -+disk_write_cont (void *cls, -+ const void *pt_block, -+ uint16_t pt_size, -+ char *emsg) -+{ -+ struct GNUNET_DISK_FileHandle *fh = cls; -+ -+ GNUNET_assert (NULL != fh); -+ GNUNET_assert (NULL != pt_block); -+ GNUNET_assert (NULL == emsg); -+ GNUNET_assert (pt_size == GNUNET_DISK_file_write (fh, pt_block, pt_size)); -+} -+ -+ -+/** - * Callback to be called when testbed has connected to the fs service - * - * @param cls the 'struct TestPublishOperation' -@@ -361,9 +378,7 @@ publish_fs_connect_complete_cb (void *cls, - struct TestPublishOperation *po = cls; - struct GNUNET_FS_FileInformation *fi; - struct GNUNET_DISK_FileHandle *fh; -- char *em; - uint64_t off; -- char buf[DBLOCK_SIZE]; - size_t bsize; - struct GNUNET_FS_BlockOptions bo; - -@@ -395,11 +410,8 @@ publish_fs_connect_complete_cb (void *cls, - off = 0; - while (off < po->size) - { -- bsize = GNUNET_MIN (sizeof (buf), po->size - off); -- emsg = NULL; -- GNUNET_assert (bsize == file_generator (&po->publish_seed, off, bsize, buf, &em)); -- GNUNET_assert (em == NULL); -- GNUNET_assert (bsize == GNUNET_DISK_file_write (fh, buf, bsize)); -+ bsize = GNUNET_MIN (DBLOCK_SIZE, po->size - off); -+ GNUNET_assert (GNUNET_OK == file_generator (&po->publish_seed, off, bsize, disk_write_cont, fh)); - off += bsize; - } - GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); -diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c -index 1f391da71..c90c6dc93 100644 ---- a/src/fs/fs_tree.c -+++ b/src/fs/fs_tree.c -@@ -320,59 +320,27 @@ compute_chk_offset (unsigned int depth, uint64_t end_offset) - - - /** -- * Encrypt the next block of the file (and call proc and progress -- * accordingly; or of course "cont" if we have already completed -- * encoding of the entire file). -- * -- * @param te tree encoder to use -+ * Continuation for te->reader - */ --void --GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) -+static void -+encrypt_block(void *cls, -+ const void *pt_block, -+ uint16_t pt_size, -+ char *emsg) - { -+ struct GNUNET_FS_TreeEncoder *te = cls; - struct ContentHashKey *mychk; -- const void *pt_block; -- uint16_t pt_size; -- char iob[DBLOCK_SIZE]; - char enc[DBLOCK_SIZE]; - struct GNUNET_CRYPTO_SymmetricSessionKey sk; - struct GNUNET_CRYPTO_SymmetricInitializationVector iv; - unsigned int off; - -- GNUNET_assert (GNUNET_NO == te->in_next); -- te->in_next = GNUNET_YES; -- if (te->chk_tree_depth == te->current_depth) -- { -- off = CHK_PER_INODE * (te->chk_tree_depth - 1); -- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n", -- GNUNET_h2s (&te->chk_tree[off].query), off); -- te->uri = GNUNET_new (struct GNUNET_FS_Uri); -- te->uri->type = GNUNET_FS_URI_CHK; -- te->uri->data.chk.chk = te->chk_tree[off]; -- te->uri->data.chk.file_length = GNUNET_htonll (te->size); -+ if (NULL != emsg || NULL == pt_block) { -+ te->emsg = emsg; - te->in_next = GNUNET_NO; - te->cont (te->cls); - return; - } -- if (0 == te->current_depth) -- { -- /* read DBLOCK */ -- pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset); -- if (pt_size != -- te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg)) -- { -- te->in_next = GNUNET_NO; -- te->cont (te->cls); -- return; -- } -- pt_block = iob; -- } -- else -- { -- pt_size = -- GNUNET_FS_tree_compute_iblock_size (te->current_depth, -- te->publish_offset); -- pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; -- } - off = compute_chk_offset (te->current_depth, te->publish_offset); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "TE is at offset %llu and depth %u with block size %u and target-CHK-offset %u\n", -@@ -414,6 +382,58 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) - - - /** -+ * Encrypt the next block of the file (and call proc and progress -+ * accordingly; or of course "cont" if we have already completed -+ * encoding of the entire file). -+ * -+ * @param te tree encoder to use -+ */ -+void -+GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) -+{ -+ const void *pt_block; -+ uint16_t pt_size; -+ unsigned int off; -+ -+ GNUNET_assert (GNUNET_NO == te->in_next); -+ te->in_next = GNUNET_YES; -+ if (te->chk_tree_depth == te->current_depth) -+ { -+ off = CHK_PER_INODE * (te->chk_tree_depth - 1); -+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n", -+ GNUNET_h2s (&te->chk_tree[off].query), off); -+ te->uri = GNUNET_new (struct GNUNET_FS_Uri); -+ te->uri->type = GNUNET_FS_URI_CHK; -+ te->uri->data.chk.chk = te->chk_tree[off]; -+ te->uri->data.chk.file_length = GNUNET_htonll (te->size); -+ te->in_next = GNUNET_NO; -+ te->cont (te->cls); -+ return; -+ } -+ if (0 == te->current_depth) -+ { -+ /* read DBLOCK */ -+ pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset); -+ if (GNUNET_OK != -+ te->reader (te->cls, te->publish_offset, pt_size, &encrypt_block, te)) -+ { -+ te->in_next = GNUNET_NO; -+ te->cont (te->cls); -+ return; -+ } -+ } -+ else -+ { -+ pt_size = -+ GNUNET_FS_tree_compute_iblock_size (te->current_depth, -+ te->publish_offset); -+ pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; -+ encrypt_block(te, pt_block, pt_size, NULL); -+ } -+} -+ -+ -+/** - * Get the resulting URI from the encoding. - * - * @param te the tree encoder to clean up -@@ -444,7 +464,7 @@ GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, - { - if (NULL != te->reader) - { -- (void) te->reader (te->cls, UINT64_MAX, 0, 0, NULL); -+ (void) te->reader (te->cls, UINT64_MAX, 0, NULL, NULL); - te->reader = NULL; - } - GNUNET_assert (GNUNET_NO == te->in_next); -diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c -index 776c868e6..a62668b9a 100644 ---- a/src/fs/fs_unindex.c -+++ b/src/fs/fs_unindex.c -@@ -41,32 +41,37 @@ - * @param offset identifies which block to get - * @param max (maximum) number of bytes to get; returning - * fewer will also cause errors -- * @param buf where to copy the plaintext buffer -- * @param emsg location to store an error message (on error) -- * @return number of bytes copied to buf, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ --static size_t -+static int - unindex_reader (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg) -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls) - { - struct GNUNET_FS_UnindexContext *uc = cls; -- size_t pt_size; -+ char buf[max]; - -- pt_size = GNUNET_MIN (max, uc->file_size - offset); - if (offset != GNUNET_DISK_file_seek (uc->fh, offset, GNUNET_DISK_SEEK_SET)) - { -- *emsg = GNUNET_strdup (_("Failed to find given position in file")); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, -+ GNUNET_strdup (_("Failed to find given position in file"))); -+ return GNUNET_OK; - } -- if (pt_size != GNUNET_DISK_file_read (uc->fh, buf, pt_size)) -+ if (max != GNUNET_DISK_file_read (uc->fh, buf, max)) - { -- *emsg = GNUNET_strdup (_("Failed to read file")); -- return 0; -+ if (cont) -+ cont (cont_cls, NULL, max, GNUNET_strdup (_("Failed to read file"))); -+ return GNUNET_OK; - } -- return pt_size; -+ if (cont) -+ cont (cont_cls, buf, max, NULL); -+ return GNUNET_OK; - } - - -diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h -index 2030c942c..162222c26 100644 ---- a/src/include/gnunet_fs_service.h -+++ b/src/include/gnunet_fs_service.h -@@ -1858,6 +1858,20 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, - - - /** -+ * Continuation for GNUNET_FS_DataReader -+ * -+ * @param cls closure -+ * @param pt_block pointer to bytes read by the reader -+ * @param pt_size the number of bytes read, must be equal to max -+ * @param emsg error message, NULL is there is no error -+ */ -+typedef void (*GNUNET_FS_ReaderContinuation) (void *cls, -+ const void *pt_block, -+ uint16_t pt_size, -+ char *emsg); -+ -+ -+/** - * Function that provides data. - * - * @param cls closure -@@ -1869,20 +1883,21 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, - * clean up the reader's state); in this case, - * a value of '0' for max should be ignored - * @param max maximum number of bytes that should be -- * copied to buf; readers are not allowed -+ * passed to cont; readers are not allowed - * to provide less data unless there is an error; - * a value of "0" will be used at the end to allow - * the reader to clean up its internal state -- * @param buf where the reader should write the data -- * @param emsg location for the reader to store an error message -- * @return number of bytes written, usually @a max, 0 on error -+ * @param cont continuation to call with a pointer to the read bytes or an -+ * error message -+ * @param cont_cls closure to pass to the continuation -+ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise - */ - typedef size_t - (*GNUNET_FS_DataReader) (void *cls, - uint64_t offset, - size_t max, -- void *buf, -- char **emsg); -+ GNUNET_FS_ReaderContinuation cont, -+ void *cont_cls); - - - /** -diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am -index f0d5639a1..f1fbd0ef2 100644 ---- a/src/nat/Makefile.am -+++ b/src/nat/Makefile.am -@@ -15,24 +15,6 @@ pkgcfgdir= $(pkgdatadir)/config.d/ - pkgcfg_DATA = \ - nat.conf - --if LINUX -- NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client -- NATSERVER = gnunet-helper-nat-server.c -- NATCLIENT = gnunet-helper-nat-client.c --install-exec-hook: -- $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true --else --if XFREEBSD -- NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client -- NATSERVER = gnunet-helper-nat-server.c -- NATCLIENT = gnunet-helper-nat-client.c --install-exec-hook: -- $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true --endif --else --install-exec-hook: --endif -- - bin_PROGRAMS = \ - gnunet-nat - -diff --git a/src/peerstore/Makefile.am b/src/peerstore/Makefile.am -index 3aef05769..beaf6a204 100644 ---- a/src/peerstore/Makefile.am -+++ b/src/peerstore/Makefile.am -@@ -81,7 +81,20 @@ libgnunet_plugin_peerstore_sqlite_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) - endif - -+libgnunet_plugin_peerstore_emscripten_la_SOURCES = \ -+ plugin_peerstore_emscripten.c -+libgnunet_plugin_peerstore_emscripten_la_LIBADD = \ -+ $(top_builddir)/src/peerstore/libgnunetpeerstore.la \ -+ $(top_builddir)/src/util/libgnunetutil.la \ -+ $(LTLIBINTL) -+libgnunet_plugin_peerstore_emscripten_la_LDFLAGS = \ -+ $(GN_PLUGIN_LDFLAGS) -+libgnunet_plugin_peerstore_emscripten_la_DEPENDENCIES = \ -+ $(top_builddir)/src/util/libgnunetutil.la \ -+ libgnunetpeerstore.la -+ - plugin_LTLIBRARIES = \ -+ libgnunet_plugin_peerstore_emscripten.la \ - $(SQLITE_PLUGIN) \ - $(FLAT_PLUGIN) - -diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am -index d0db6b141..46ac240d8 100644 ---- a/src/transport/Makefile.am -+++ b/src/transport/Makefile.am -@@ -80,20 +80,6 @@ endif - - if HAVE_EXPERIMENTAL - if LINUX -- WLAN_BIN = gnunet-helper-transport-wlan -- WLAN_BIN_DUMMY = gnunet-helper-transport-wlan-dummy -- WLAN_BIN_SENDER = gnunet-transport-wlan-sender -- WLAN_BIN_RECEIVER = gnunet-transport-wlan-receiver -- WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la -- WLAN_PLUGIN_TEST = test_plugin_wlan -- WLAN_API_TEST = test_transport_api_wlan -- WLAN_TIMEOUT_TEST = test_transport_api_timeout_wlan -- WLAN_REL_TEST = test_transport_api_reliability_wlan -- WLAN_QUOTA_TEST = test_quota_compliance_wlan \ -- test_quota_compliance_wlan_asymmetric --endif -- --if LINUX - install-exec-hook: - $(top_srcdir)/src/transport/install-wlan-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true - if HAVE_LIBBLUETOOTH -@@ -278,27 +264,8 @@ gnunet_service_transport_CFLAGS = \ - $(CFLAGS) - # -DANALYZE - --plugin_LTLIBRARIES = \ -- libgnunet_plugin_transport_tcp.la \ -- libgnunet_plugin_transport_udp.la \ -- $(UNIX_PLUGIN_LA) \ -- $(HTTP_CLIENT_PLUGIN_LA) \ -- $(HTTPS_CLIENT_PLUGIN_LA) \ -- $(HTTP_SERVER_PLUGIN_LA) \ -- $(HTTPS_SERVER_PLUGIN_LA) \ -- $(WLAN_PLUGIN_LA) \ -- $(BT_PLUGIN_LA) -- --if HAVE_EXPERIMENTAL --plugin_LTLIBRARIES += \ -- libgnunet_plugin_transport_xt.la \ -- libgnunet_plugin_transport_xu.la --endif -- --# Note: real plugins of course need to be added --# to the plugin_LTLIBRARIES above --noinst_LTLIBRARIES = \ -- libgnunet_plugin_transport_template.la -+plugin_LTLIBRARIES = libgnunet_plugin_transport_http_client.la \ -+ libgnunet_plugin_transport_webrtc.la - - libgnunet_plugin_transport_tcp_la_SOURCES = \ - plugin_transport_tcp.c -@@ -398,19 +365,35 @@ libgnunet_plugin_transport_unix_la_LDFLAGS = \ - - - libgnunet_plugin_transport_http_client_la_SOURCES = \ -- plugin_transport_http_client.c plugin_transport_http_common.c plugin_transport_http_common.h -+ plugin_transport_http_client_emscripten.c plugin_transport_http_common.c plugin_transport_http_common.h - libgnunet_plugin_transport_http_client_la_LIBADD = \ - $(top_builddir)/src/hello/libgnunethello.la \ - $(top_builddir)/src/statistics/libgnunetstatistics.la \ - $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ -- $(LIB_GNURL) \ -- $(top_builddir)/src/util/libgnunetutil.la -+ $(top_builddir)/src/util/libgnunetutil.la \ -+ $(LTLIBINTL) - libgnunet_plugin_transport_http_client_la_LDFLAGS = \ - $(GN_PLUGIN_LDFLAGS) - libgnunet_plugin_transport_http_client_la_CFLAGS = \ - $(CFLAGS) - libgnunet_plugin_transport_http_client_la_CPPFLAGS = \ -- $(CPP_GNURL) $(AM_CPPFLAGS) -+ $(AM_CPPFLAGS) -+ -+ -+libgnunet_plugin_transport_webrtc_la_SOURCES = \ -+ plugin_transport_webrtc.c -+libgnunet_plugin_transport_webrtc_la_LIBADD = \ -+ $(top_builddir)/src/hello/libgnunethello.la \ -+ $(top_builddir)/src/statistics/libgnunetstatistics.la \ -+ $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ -+ $(top_builddir)/src/util/libgnunetutil.la \ -+ $(LTLIBINTL) -+libgnunet_plugin_transport_webrtc_la_LDFLAGS = \ -+ $(GN_PLUGIN_LDFLAGS) -+libgnunet_plugin_transport_webrtc_la_CFLAGS = \ -+ $(CFLAGS) -+libgnunet_plugin_transport_webrtc_la_CPPFLAGS = \ -+ $(AM_CPPFLAGS) - - - libgnunet_plugin_transport_http_server_la_SOURCES = \ -diff --git a/src/transport/tcp_connection_legacy.c b/src/transport/tcp_connection_legacy.c -index 66902c6a0..02c1cf37e 100644 ---- a/src/transport/tcp_connection_legacy.c -+++ b/src/transport/tcp_connection_legacy.c -@@ -406,7 +406,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb, - &gc.gid)) - gcp = &gc; - #else --#ifdef SO_PEERCRED -+#if 0 - /* largely traditional GNU/Linux */ - olen = sizeof (uc); - if ( (0 == -diff --git a/src/util/Makefile.am b/src/util/Makefile.am -index b0f45b1da..4742eab03 100644 ---- a/src/util/Makefile.am -+++ b/src/util/Makefile.am -@@ -71,8 +71,6 @@ libgnunetutil_la_SOURCES = \ - common_allocation.c \ - common_endian.c \ - common_logging.c \ -- configuration.c \ -- configuration_loader.c \ - container_bloomfilter.c \ - container_heap.c \ - container_meta_data.c \ -@@ -104,13 +102,11 @@ libgnunetutil_la_SOURCES = \ - mst.c \ - mq.c \ - nc.c \ -- network.c \ - op.c \ - os_installation.c \ - os_network.c \ - os_priority.c \ - peer.c \ -- plugin.c \ - program.c \ - regex.c \ - resolver_api.c resolver.h \ diff --git a/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch b/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch new file mode 100644 index 0000000..ffa4361 --- /dev/null +++ b/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch @@ -0,0 +1,1056 @@ +diff --git a/configure.ac b/configure.ac +index 3f1450ba2..114254f57 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1109,7 +1109,7 @@ AC_ARG_WITH(ltdl, + AC_CHECK_HEADERS(ltdl.h, + AC_CHECK_LIB([ltdl], [lt_dlopenext], + ltdl=1))]) +-AS_IF([test x$ltdl = x1], ++AS_IF([true], + [ + AC_MSG_RESULT([libltdl found]) + ],[ +@@ -2132,7 +2132,7 @@ AS_IF([test "$mysql" = true], + AS_IF([test x$mysqlfail = xtrue], + [AC_MSG_WARN([MySQL not found (or too old), will not create MySQL database support]) + mysql_msg="unsupported version"]) +-AS_IF([test "$sqlite" = true], ++AS_IF([true], + [features_msg="$features_msg sqlite" + sqlite_msg="yes"], + [AC_MSG_ERROR([sqlite3 not found, but sqlite3 is required.]) +diff --git a/src/Makefile.am b/src/Makefile.am +index 1bcc1ae7b..9d12df48b 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -76,7 +76,6 @@ SUBDIRS = \ + include $(INTLEMU_SUBDIRS) \ + util \ + nt \ +- gnsrecord \ + hello \ + block \ + statistics \ +@@ -84,7 +83,6 @@ SUBDIRS = \ + $(TESTING) \ + $(JSON_DIR) \ + $(CURL_DIR) \ +- $(REST_DIR) \ + peerinfo \ + $(SQLITE_DIR) \ + $(MYSQL_DIR) \ +@@ -105,28 +103,18 @@ SUBDIRS = \ + $(ATS_TESTS) \ + nse \ + dht \ +- hostlist \ + topology \ + regex \ + dns \ + identity \ +- namecache \ +- namestore \ + cadet \ + set \ + consensus \ + scalarproduct \ + revocation \ +- vpn \ +- gns \ +- zonemaster \ + $(CONVERSATION_DIR) \ + fs \ +- exit \ +- pt \ +- secretsharing \ + $(RECLAIM_DIR) \ +- $(EXP_DIR) \ +- integration-tests ++ $(EXP_DIR) + + endif +diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am +index cd1df4e5e..9b7f72687 100644 +--- a/src/datastore/Makefile.am ++++ b/src/datastore/Makefile.am +@@ -100,7 +100,8 @@ plugin_LTLIBRARIES = \ + $(SQLITE_PLUGIN) \ + $(MYSQL_PLUGIN) \ + $(POSTGRES_PLUGIN) \ +- libgnunet_plugin_datastore_heap.la ++ libgnunet_plugin_datastore_heap.la \ ++ libgnunet_plugin_datastore_emscripten.la + + # Real plugins should of course go into + # plugin_LTLIBRARIES +@@ -127,6 +128,13 @@ libgnunet_plugin_datastore_heap_la_LIBADD = \ + libgnunet_plugin_datastore_heap_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) + ++libgnunet_plugin_datastore_emscripten_la_SOURCES = \ ++ plugin_datastore_emscripten.c ++libgnunet_plugin_datastore_emscripten_la_LIBADD = \ ++ $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ ++ $(LTLIBINTL) ++libgnunet_plugin_datastore_emscripten_la_LDFLAGS = \ ++ $(GN_PLUGIN_LDFLAGS) + + libgnunet_plugin_datastore_mysql_la_SOURCES = \ + plugin_datastore_mysql.c +diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am +index 2182d1c7f..f7442e37e 100644 +--- a/src/dht/Makefile.am ++++ b/src/dht/Makefile.am +@@ -47,15 +47,6 @@ libgnunet_plugin_block_dht_la_LDFLAGS = \ + libexec_PROGRAMS = \ + gnunet-service-dht + +-bin_PROGRAMS = \ +- gnunet-dht-monitor \ +- gnunet-dht-get \ +- gnunet-dht-put +- +-if HAVE_TESTING +-noinst_PROGRAMS = \ +- gnunet-dht-profiler +-endif + + gnunet_service_dht_SOURCES = \ + gnunet-service-dht.c gnunet-service-dht.h \ +diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am +index 17be841f5..944957c8d 100644 +--- a/src/dns/Makefile.am ++++ b/src/dns/Makefile.am +@@ -14,10 +14,6 @@ plugindir = $(libdir)/gnunet + pkgcfg_DATA = \ + dns.conf + +-if LINUX +-HIJACKBIN = gnunet-helper-dns +-endif +- + lib_LTLIBRARIES = \ + libgnunetdns.la + +diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c +index e04a93f9c..707ed81a8 100644 +--- a/src/fs/fs_api.c ++++ b/src/fs/fs_api.c +@@ -449,19 +449,22 @@ struct FileInfo + * to provide less data unless there is an error; + * a value of "0" will be used at the end to allow + * the reader to clean up its internal state +- * @param buf where the reader should write the data +- * @param emsg location for the reader to store an error message +- * @return number of bytes written, usually @a max, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-size_t ++int + GNUNET_FS_data_reader_file_ (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg) ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls) + { + struct FileInfo *fi = cls; + ssize_t ret; ++ char **emsg = NULL; ++ char buf[max]; + + if (UINT64_MAX == offset) + { +@@ -470,7 +473,7 @@ GNUNET_FS_data_reader_file_ (void *cls, + GNUNET_DISK_file_close (fi->fd); + fi->fd = NULL; + } +- return 0; ++ return GNUNET_SYSERR; + } + if (0 == max) + { +@@ -478,7 +481,7 @@ GNUNET_FS_data_reader_file_ (void *cls, + GNUNET_DISK_file_close (fi->fd); + GNUNET_free (fi->filename); + GNUNET_free (fi); +- return 0; ++ return GNUNET_SYSERR; + } + if (NULL == fi->fd) + { +@@ -491,7 +494,9 @@ GNUNET_FS_data_reader_file_ (void *cls, + _ ("Could not open file `%s': %s"), + fi->filename, + strerror (errno)); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, *emsg); ++ return GNUNET_OK; + } + } + if ((GNUNET_SYSERR == +@@ -502,16 +507,22 @@ GNUNET_FS_data_reader_file_ (void *cls, + _ ("Could not read file `%s': %s"), + fi->filename, + strerror (errno)); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, *emsg); ++ return GNUNET_OK; + } + if (ret != max) + { + GNUNET_asprintf (emsg, + _ ("Short read reading from file `%s'!"), + fi->filename); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, *emsg); ++ return GNUNET_OK; + } +- return max; ++ if (cont) ++ cont (cont_cls, buf, max, NULL); ++ return GNUNET_OK; + } + + +@@ -553,28 +564,30 @@ GNUNET_FS_make_file_reader_context_ (const char *filename) + * to provide less data unless there is an error; + * a value of "0" will be used at the end to allow + * the reader to clean up its internal state +- * @param buf where the reader should write the data +- * @param emsg location for the reader to store an error message +- * @return number of bytes written, usually @a max, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-size_t ++int + GNUNET_FS_data_reader_copy_ (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg) ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls) + { + char *data = cls; + + if (UINT64_MAX == offset) +- return 0; ++ return GNUNET_SYSERR; + if (0 == max) + { + GNUNET_free_non_null (data); +- return 0; ++ return GNUNET_SYSERR; + } +- GNUNET_memcpy (buf, &data[offset], max); +- return max; ++ if (cont) ++ cont (cont_cls, &data[offset], max, NULL); ++ return GNUNET_OK; + } + + +@@ -1265,43 +1278,6 @@ make_serialization_file_name_in_dir (struct GNUNET_FS_Handle *h, + } + + +-/** +- * Copy all of the data from the reader to the write handle. +- * +- * @param wh write handle +- * @param fi file with reader +- * @return #GNUNET_OK on success +- */ +-static int +-copy_from_reader (struct GNUNET_BIO_WriteHandle *wh, +- struct GNUNET_FS_FileInformation *fi) +-{ +- char buf[32 * 1024]; +- uint64_t off; +- size_t ret; +- size_t left; +- char *emsg; +- +- emsg = NULL; +- off = 0; +- while (off < fi->data.file.file_size) +- { +- left = GNUNET_MIN (sizeof(buf), fi->data.file.file_size - off); +- ret = +- fi->data.file.reader (fi->data.file.reader_cls, off, left, buf, &emsg); +- if (0 == ret) +- { +- GNUNET_free (emsg); +- return GNUNET_SYSERR; +- } +- if (GNUNET_OK != GNUNET_BIO_write (wh, buf, ret)) +- return GNUNET_SYSERR; +- off += ret; +- } +- return GNUNET_OK; +-} +- +- + /** + * Create a temporary file on disk to store the current + * state of @a fi in. +@@ -1386,7 +1362,6 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *fi) + goto cleanup; + } + if ((GNUNET_NO == fi->is_published) && (NULL == fi->filename)) +- if (GNUNET_OK != copy_from_reader (wh, fi)) + { + GNUNET_break (0); + goto cleanup; +diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h +index 0228e37ce..211dde9d8 100644 +--- a/src/fs/fs_api.h ++++ b/src/fs/fs_api.h +@@ -654,16 +654,17 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe); + * to provide less data unless there is an error; + * a value of "0" will be used at the end to allow + * the reader to clean up its internal state +- * @param buf where the reader should write the data +- * @param emsg location for the reader to store an error message +- * @return number of bytes written, usually "max", 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-size_t ++int + GNUNET_FS_data_reader_file_ (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg); ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls); + + + /** +@@ -688,16 +689,17 @@ GNUNET_FS_make_file_reader_context_ (const char *filename); + * to provide less data unless there is an error; + * a value of "0" will be used at the end to allow + * the reader to clean up its internal state +- * @param buf where the reader should write the data +- * @param emsg location for the reader to store an error message +- * @return number of bytes written, usually @a max, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-size_t ++int + GNUNET_FS_data_reader_copy_ (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg); ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls); + + + /** +diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c +index 4d03b6546..0b3c75a4a 100644 +--- a/src/fs/fs_download.c ++++ b/src/fs/fs_download.c +@@ -1769,33 +1769,36 @@ reconstruct_cb (void *cls, + * @param offset identifies which block to get + * @param max (maximum) number of bytes to get; returning + * fewer will also cause errors +- * @param buf where to copy the plaintext buffer +- * @param emsg location to store an error message (on error) +- * @return number of bytes copied to buf, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-static size_t +-fh_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) ++static int ++fh_reader (void *cls, uint64_t offset, size_t max, ++ GNUNET_FS_ReaderContinuation cont, void *cont_cls) + { + struct GNUNET_FS_DownloadContext *dc = cls; + struct GNUNET_DISK_FileHandle *fh = dc->rfh; + ssize_t ret; ++ char buf[max]; + +- if (NULL != emsg) +- *emsg = NULL; + if (offset != GNUNET_DISK_file_seek (fh, offset, GNUNET_DISK_SEEK_SET)) + { +- if (NULL != emsg) +- *emsg = GNUNET_strdup (strerror (errno)); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, GNUNET_strdup (strerror (errno))); ++ return GNUNET_OK; + } + ret = GNUNET_DISK_file_read (fh, buf, max); + if (ret < 0) + { +- if (NULL != emsg) +- *emsg = GNUNET_strdup (strerror (errno)); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, GNUNET_strdup (strerror (errno))); ++ return GNUNET_OK; + } +- return ret; ++ if (cont) ++ cont (cont_cls, buf, max, NULL); ++ return GNUNET_OK; + } + + +diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c +index 8bb57b1e2..03271ddca 100644 +--- a/src/fs/fs_publish.c ++++ b/src/fs/fs_publish.c +@@ -363,24 +363,24 @@ publish_kblocks_cont (void *cls, + * @param emsg location to store an error message (on error) + * @return number of bytes copied to buf, 0 on error + */ +-static size_t ++static int + block_reader (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg) ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls) + { + struct GNUNET_FS_PublishContext *pc = cls; + struct GNUNET_FS_FileInformation *p; + const char *dd; +- size_t pt_size; + + p = pc->fi_pos; + if (GNUNET_YES == p->is_directory) + { +- pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); + dd = p->data.dir.dir_data; +- GNUNET_memcpy (buf, &dd[offset], pt_size); ++ if (cont) ++ cont (cont_cls, &dd[offset], max, NULL); ++ return GNUNET_OK; + } + else + { +@@ -391,18 +391,11 @@ block_reader (void *cls, + /* force closing the file to avoid keeping too many files open */ + p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); + } +- return 0; ++ return GNUNET_SYSERR; /* return value ignored in this case */ + } +- pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); +- if (0 == pt_size) +- return 0; /* calling reader with pt_size==0 +- * might free buf, so don't! */ +- if (pt_size != +- p->data.file.reader (p->data.file.reader_cls, offset, pt_size, buf, +- emsg)) +- return 0; +- } +- return pt_size; ++ return p->data.file.reader (p->data.file.reader_cls, offset, max, ++ cont, cont_cls); ++ } + } + + +@@ -615,7 +608,6 @@ static void + publish_content (struct GNUNET_FS_PublishContext *pc) + { + struct GNUNET_FS_FileInformation *p; +- char *emsg; + struct GNUNET_FS_DirectoryBuilder *db; + struct GNUNET_FS_FileInformation *dirpos; + void *raw_data; +@@ -640,23 +632,6 @@ publish_content (struct GNUNET_FS_PublishContext *pc) + else + { + raw_data = NULL; +- if ((dirpos->data.file.file_size < MAX_INLINE_SIZE) && +- (dirpos->data.file.file_size > 0)) +- { +- raw_data = GNUNET_malloc (dirpos->data.file.file_size); +- emsg = NULL; +- if (dirpos->data.file.file_size != +- dirpos->data.file.reader (dirpos->data.file.reader_cls, 0, +- dirpos->data.file.file_size, raw_data, +- &emsg)) +- { +- GNUNET_free_non_null (emsg); +- GNUNET_free (raw_data); +- raw_data = NULL; +- } +- dirpos->data.file.reader (dirpos->data.file.reader_cls, UINT64_MAX, +- 0, 0, NULL); +- } + } + GNUNET_FS_directory_builder_add (db, dirpos->chk_uri, dirpos->meta, + raw_data); +diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c +index a0fe336df..12eaf838c 100644 +--- a/src/fs/fs_test_lib.c ++++ b/src/fs/fs_test_lib.c +@@ -274,26 +274,23 @@ publish_progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) + * @param cls pointer to uint32_t with publishing seed + * @param offset offset to generate data for + * @param max maximum number of bytes to generate +- * @param buf where to write generated data +- * @param emsg where to store error message (unused) +- * @return number of bytes written to buf ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-static size_t ++static int + file_generator (void *cls, +- uint64_t offset, +- size_t max, +- void *buf, +- char **emsg) ++ uint64_t offset, ++ size_t max, ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls) + { + uint32_t *publish_seed = cls; + uint64_t pos; +- uint8_t *cbuf = buf; ++ uint8_t cbuf[max]; + int mod; + +- if (emsg != NULL) +- *emsg = NULL; +- if (buf == NULL) +- return 0; + for (pos = 0; pos < 8; pos++) + cbuf[pos] = (uint8_t) (offset >> pos * 8); + for (pos = 8; pos < max; pos++) +@@ -303,7 +300,9 @@ file_generator (void *cls, + mod = 1; + cbuf[pos] = (uint8_t) ((offset * (*publish_seed)) % mod); + } +- return max; ++ if (cont) ++ cont (cont_cls, cbuf, max, NULL); ++ return GNUNET_OK; + } + + +@@ -346,6 +345,24 @@ fs_disconnect_adapter (void *cls, + } + + ++/** ++ * Continuation for GNUNET_FS_DataReader ++ */ ++static void ++disk_write_cont (void *cls, ++ const void *pt_block, ++ uint16_t pt_size, ++ char *emsg) ++{ ++ struct GNUNET_DISK_FileHandle *fh = cls; ++ ++ GNUNET_assert (NULL != fh); ++ GNUNET_assert (NULL != pt_block); ++ GNUNET_assert (NULL == emsg); ++ GNUNET_assert (pt_size == GNUNET_DISK_file_write (fh, pt_block, pt_size)); ++} ++ ++ + /** + * Callback to be called when testbed has connected to the fs service + * +@@ -364,9 +381,7 @@ publish_fs_connect_complete_cb (void *cls, + struct TestPublishOperation *po = cls; + struct GNUNET_FS_FileInformation *fi; + struct GNUNET_DISK_FileHandle *fh; +- char *em; + uint64_t off; +- char buf[DBLOCK_SIZE]; + size_t bsize; + struct GNUNET_FS_BlockOptions bo; + +@@ -399,12 +414,8 @@ publish_fs_connect_complete_cb (void *cls, + off = 0; + while (off < po->size) + { +- bsize = GNUNET_MIN (sizeof(buf), po->size - off); +- emsg = NULL; +- GNUNET_assert (bsize == file_generator (&po->publish_seed, off, bsize, +- buf, &em)); +- GNUNET_assert (em == NULL); +- GNUNET_assert (bsize == GNUNET_DISK_file_write (fh, buf, bsize)); ++ bsize = GNUNET_MIN (DBLOCK_SIZE, po->size - off); ++ GNUNET_assert (GNUNET_OK == file_generator (&po->publish_seed, off, bsize, disk_write_cont, fh)); + off += bsize; + } + GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); +diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c +index e7f922823..8af3b39c3 100644 +--- a/src/fs/fs_tree.c ++++ b/src/fs/fs_tree.c +@@ -321,59 +321,27 @@ compute_chk_offset (unsigned int depth, uint64_t end_offset) + + + /** +- * Encrypt the next block of the file (and call proc and progress +- * accordingly; or of course "cont" if we have already completed +- * encoding of the entire file). +- * +- * @param te tree encoder to use ++ * Continuation for te->reader + */ +-void +-GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) ++static void ++encrypt_block(void *cls, ++ const void *pt_block, ++ uint16_t pt_size, ++ char *emsg) + { ++ struct GNUNET_FS_TreeEncoder *te = cls; + struct ContentHashKey *mychk; +- const void *pt_block; +- uint16_t pt_size; +- char iob[DBLOCK_SIZE]; + char enc[DBLOCK_SIZE]; + struct GNUNET_CRYPTO_SymmetricSessionKey sk; + struct GNUNET_CRYPTO_SymmetricInitializationVector iv; + unsigned int off; + +- GNUNET_assert (GNUNET_NO == te->in_next); +- te->in_next = GNUNET_YES; +- if (te->chk_tree_depth == te->current_depth) +- { +- off = CHK_PER_INODE * (te->chk_tree_depth - 1); +- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n", +- GNUNET_h2s (&te->chk_tree[off].query), off); +- te->uri = GNUNET_new (struct GNUNET_FS_Uri); +- te->uri->type = GNUNET_FS_URI_CHK; +- te->uri->data.chk.chk = te->chk_tree[off]; +- te->uri->data.chk.file_length = GNUNET_htonll (te->size); ++ if (NULL != emsg || NULL == pt_block) { ++ te->emsg = emsg; + te->in_next = GNUNET_NO; + te->cont (te->cls); + return; + } +- if (0 == te->current_depth) +- { +- /* read DBLOCK */ +- pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset); +- if (pt_size != +- te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg)) +- { +- te->in_next = GNUNET_NO; +- te->cont (te->cls); +- return; +- } +- pt_block = iob; +- } +- else +- { +- pt_size = +- GNUNET_FS_tree_compute_iblock_size (te->current_depth, +- te->publish_offset); +- pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; +- } + off = compute_chk_offset (te->current_depth, te->publish_offset); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "TE is at offset %llu and depth %u with block size %u and target-CHK-offset %u\n", +@@ -414,6 +382,58 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) + } + + ++/** ++ * Encrypt the next block of the file (and call proc and progress ++ * accordingly; or of course "cont" if we have already completed ++ * encoding of the entire file). ++ * ++ * @param te tree encoder to use ++ */ ++void ++GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) ++{ ++ const void *pt_block; ++ uint16_t pt_size; ++ unsigned int off; ++ ++ GNUNET_assert (GNUNET_NO == te->in_next); ++ te->in_next = GNUNET_YES; ++ if (te->chk_tree_depth == te->current_depth) ++ { ++ off = CHK_PER_INODE * (te->chk_tree_depth - 1); ++ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n", ++ GNUNET_h2s (&te->chk_tree[off].query), off); ++ te->uri = GNUNET_new (struct GNUNET_FS_Uri); ++ te->uri->type = GNUNET_FS_URI_CHK; ++ te->uri->data.chk.chk = te->chk_tree[off]; ++ te->uri->data.chk.file_length = GNUNET_htonll (te->size); ++ te->in_next = GNUNET_NO; ++ te->cont (te->cls); ++ return; ++ } ++ if (0 == te->current_depth) ++ { ++ /* read DBLOCK */ ++ pt_size = GNUNET_MIN (DBLOCK_SIZE, te->size - te->publish_offset); ++ if (GNUNET_OK != ++ te->reader (te->cls, te->publish_offset, pt_size, &encrypt_block, te)) ++ { ++ te->in_next = GNUNET_NO; ++ te->cont (te->cls); ++ return; ++ } ++ } ++ else ++ { ++ pt_size = ++ GNUNET_FS_tree_compute_iblock_size (te->current_depth, ++ te->publish_offset); ++ pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; ++ encrypt_block(te, pt_block, pt_size, NULL); ++ } ++} ++ ++ + /** + * Get the resulting URI from the encoding. + * +@@ -445,7 +465,7 @@ GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, + { + if (NULL != te->reader) + { +- (void) te->reader (te->cls, UINT64_MAX, 0, 0, NULL); ++ (void) te->reader (te->cls, UINT64_MAX, 0, NULL, NULL); + te->reader = NULL; + } + GNUNET_assert (GNUNET_NO == te->in_next); +diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c +index f2315d7d0..09d1c18bd 100644 +--- a/src/fs/fs_unindex.c ++++ b/src/fs/fs_unindex.c +@@ -43,32 +43,37 @@ + * @param offset identifies which block to get + * @param max (maximum) number of bytes to get; returning + * fewer will also cause errors +- * @param buf where to copy the plaintext buffer +- * @param emsg location to store an error message (on error) +- * @return number of bytes copied to buf, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ +-static size_t ++static int + unindex_reader (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg) ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls) + { + struct GNUNET_FS_UnindexContext *uc = cls; +- size_t pt_size; ++ char buf[max]; + +- pt_size = GNUNET_MIN (max, uc->file_size - offset); + if (offset != GNUNET_DISK_file_seek (uc->fh, offset, GNUNET_DISK_SEEK_SET)) + { +- *emsg = GNUNET_strdup (_ ("Failed to find given position in file")); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, ++ GNUNET_strdup (_ ("Failed to find given position in file"))); ++ return GNUNET_OK; + } +- if (pt_size != GNUNET_DISK_file_read (uc->fh, buf, pt_size)) ++ if (max != GNUNET_DISK_file_read (uc->fh, buf, max)) + { +- *emsg = GNUNET_strdup (_ ("Failed to read file")); +- return 0; ++ if (cont) ++ cont (cont_cls, NULL, max, GNUNET_strdup (_ ("Failed to read file"))); ++ return GNUNET_OK; + } +- return pt_size; ++ if (cont) ++ cont (cont_cls, buf, max, NULL); ++ return GNUNET_OK; + } + + +diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h +index 01d736e89..2e8648859 100644 +--- a/src/include/gnunet_fs_service.h ++++ b/src/include/gnunet_fs_service.h +@@ -1802,6 +1802,20 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, + GNUNET_FS_BlockOptions *bo); + + ++/** ++ * Continuation for GNUNET_FS_DataReader ++ * ++ * @param cls closure ++ * @param pt_block pointer to bytes read by the reader ++ * @param pt_size the number of bytes read, must be equal to max ++ * @param emsg error message, NULL is there is no error ++ */ ++typedef void (*GNUNET_FS_ReaderContinuation) (void *cls, ++ const void *pt_block, ++ uint16_t pt_size, ++ char *emsg); ++ ++ + /** + * Function that provides data. + * +@@ -1814,20 +1828,21 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, + * clean up the reader's state); in this case, + * a value of '0' for max should be ignored + * @param max maximum number of bytes that should be +- * copied to buf; readers are not allowed ++ * passed to cont; readers are not allowed + * to provide less data unless there is an error; + * a value of "0" will be used at the end to allow + * the reader to clean up its internal state +- * @param buf where the reader should write the data +- * @param emsg location for the reader to store an error message +- * @return number of bytes written, usually @a max, 0 on error ++ * @param cont continuation to call with a pointer to the read bytes or an ++ * error message ++ * @param cont_cls closure to pass to the continuation ++ * @return GNUNET_SYSERR if cont will not be called, GNUNET_OK otherwise + */ + typedef size_t + (*GNUNET_FS_DataReader) (void *cls, + uint64_t offset, + size_t max, +- void *buf, +- char **emsg); ++ GNUNET_FS_ReaderContinuation cont, ++ void *cont_cls); + + + /** +diff --git a/src/include/platform.h b/src/include/platform.h +index 3b07f47ea..b965bfe37 100644 +--- a/src/include/platform.h ++++ b/src/include/platform.h +@@ -126,9 +126,7 @@ + #include + #include + #endif +-#if defined(__linux__) || defined(GNU) + #include +-#endif + #ifdef SOLARIS + #include + #include +diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am +index 3eea5e2a4..aa15c51dc 100644 +--- a/src/nat/Makefile.am ++++ b/src/nat/Makefile.am +@@ -8,20 +8,6 @@ pkgcfgdir= $(pkgdatadir)/config.d/ + pkgcfg_DATA = \ + nat.conf + +-if LINUX +- NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client +- NATSERVER = gnunet-helper-nat-server.c +- NATCLIENT = gnunet-helper-nat-client.c +-else +-if XFREEBSD +- NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client +- NATSERVER = gnunet-helper-nat-server.c +- NATCLIENT = gnunet-helper-nat-client.c +-endif +-else +-install-exec-hook: +-endif +- + bin_PROGRAMS = \ + gnunet-nat + +diff --git a/src/peerstore/Makefile.am b/src/peerstore/Makefile.am +index babf40654..17f3bc015 100644 +--- a/src/peerstore/Makefile.am ++++ b/src/peerstore/Makefile.am +@@ -78,7 +78,20 @@ libgnunet_plugin_peerstore_sqlite_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) + endif + ++libgnunet_plugin_peerstore_emscripten_la_SOURCES = \ ++ plugin_peerstore_emscripten.c ++libgnunet_plugin_peerstore_emscripten_la_LIBADD = \ ++ $(top_builddir)/src/peerstore/libgnunetpeerstore.la \ ++ $(top_builddir)/src/util/libgnunetutil.la \ ++ $(LTLIBINTL) ++libgnunet_plugin_peerstore_emscripten_la_LDFLAGS = \ ++ $(GN_PLUGIN_LDFLAGS) ++libgnunet_plugin_peerstore_emscripten_la_DEPENDENCIES = \ ++ $(top_builddir)/src/util/libgnunetutil.la \ ++ libgnunetpeerstore.la ++ + plugin_LTLIBRARIES = \ ++ libgnunet_plugin_peerstore_emscripten.la \ + $(SQLITE_PLUGIN) \ + $(FLAT_PLUGIN) + +diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am +index c37a34ab7..caac6128c 100644 +--- a/src/transport/Makefile.am ++++ b/src/transport/Makefile.am +@@ -83,20 +83,6 @@ if USE_COVERAGE + endif + + if HAVE_EXPERIMENTAL +-if LINUX +- WLAN_BIN = gnunet-helper-transport-wlan +- WLAN_BIN_DUMMY = gnunet-helper-transport-wlan-dummy +- WLAN_BIN_SENDER = gnunet-transport-wlan-sender +- WLAN_BIN_RECEIVER = gnunet-transport-wlan-receiver +- WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la +- WLAN_PLUGIN_TEST = test_plugin_wlan +- WLAN_API_TEST = test_transport_api_wlan +- WLAN_TIMEOUT_TEST = test_transport_api_timeout_wlan +- WLAN_REL_TEST = test_transport_api_reliability_wlan +- WLAN_QUOTA_TEST = test_quota_compliance_wlan \ +- test_quota_compliance_wlan_asymmetric +-endif +- + if LINUX + if HAVE_LIBBLUETOOTH + BT_BIN = gnunet-helper-transport-bluetooth +@@ -367,24 +353,8 @@ gnunet_service_tng_LDADD = \ + $(LIBGCRYPT_LIBS) \ + $(GN_LIBINTL) + +-plugin_LTLIBRARIES = \ +- libgnunet_plugin_transport_tcp.la \ +- $(UNIX_PLUGIN_LA) \ +- $(HTTP_CLIENT_PLUGIN_LA) \ +- $(HTTPS_CLIENT_PLUGIN_LA) \ +- $(HTTP_SERVER_PLUGIN_LA) \ +- $(HTTPS_SERVER_PLUGIN_LA) \ +- $(WLAN_PLUGIN_LA) \ +- $(BT_PLUGIN_LA) +- +-if HAVE_EXPERIMENTAL +-plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la +-endif +- +-# Note: real plugins of course need to be added +-# to the plugin_LTLIBRARIES above +-noinst_LTLIBRARIES = \ +- libgnunet_plugin_transport_template.la ++plugin_LTLIBRARIES = libgnunet_plugin_transport_http_client.la \ ++ libgnunet_plugin_transport_webrtc.la + + libgnunet_plugin_transport_tcp_la_SOURCES = \ + plugin_transport_tcp.c +@@ -461,18 +431,30 @@ libgnunet_plugin_transport_unix_la_LDFLAGS = \ + + + libgnunet_plugin_transport_http_client_la_SOURCES = \ +- plugin_transport_http_client.c plugin_transport_http_common.c plugin_transport_http_common.h ++ plugin_transport_http_client_emscripten.c plugin_transport_http_common.c plugin_transport_http_common.h + libgnunet_plugin_transport_http_client_la_LIBADD = \ + $(top_builddir)/src/hello/libgnunethello.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ + $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ +- $(LIB_GNURL) \ +- $(top_builddir)/src/util/libgnunetutil.la ++ $(top_builddir)/src/util/libgnunetutil.la \ ++ $(LTLIBINTL) + libgnunet_plugin_transport_http_client_la_LDFLAGS = \ + $(GN_LIBINTL) \ + $(GN_PLUGIN_LDFLAGS) + libgnunet_plugin_transport_http_client_la_CFLAGS = \ +- $(CPP_GNURL) $(AM_CFLAGS) ++ $(AM_CFLAGS) ++ ++ ++libgnunet_plugin_transport_webrtc_la_SOURCES = \ ++ plugin_transport_webrtc.c ++libgnunet_plugin_transport_webrtc_la_LIBADD = \ ++ $(top_builddir)/src/hello/libgnunethello.la \ ++ $(top_builddir)/src/statistics/libgnunetstatistics.la \ ++ $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ ++ $(top_builddir)/src/util/libgnunetutil.la \ ++ $(LTLIBINTL) ++libgnunet_plugin_transport_webrtc_la_LDFLAGS = \ ++ $(GN_PLUGIN_LDFLAGS) + + + libgnunet_plugin_transport_http_server_la_SOURCES = \ +diff --git a/src/transport/tcp_connection_legacy.c b/src/transport/tcp_connection_legacy.c +index 4e8c8140d..7f75b2852 100644 +--- a/src/transport/tcp_connection_legacy.c ++++ b/src/transport/tcp_connection_legacy.c +@@ -400,7 +400,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb, + if (0 == getpeereid (GNUNET_NETWORK_get_fd (sock), &gc.uid, &gc.gid)) + gcp = &gc; + #else +-#ifdef SO_PEERCRED ++#if 0 + /* largely traditional GNU/Linux */ + olen = sizeof(uc); + if ((0 == getsockopt (GNUNET_NETWORK_get_fd (sock), +diff --git a/src/util/Makefile.am b/src/util/Makefile.am +index 387f22a9f..ae1ebd988 100644 +--- a/src/util/Makefile.am ++++ b/src/util/Makefile.am +@@ -43,8 +43,6 @@ libgnunetutil_la_SOURCES = \ + common_allocation.c \ + common_endian.c \ + common_logging.c \ +- configuration.c \ +- configuration_loader.c \ + container_bloomfilter.c \ + container_heap.c \ + container_meta_data.c \ +@@ -78,13 +76,11 @@ libgnunetutil_la_SOURCES = \ + mst.c \ + mq.c \ + nc.c \ +- network.c \ + op.c \ + os_installation.c \ + os_network.c \ + os_priority.c \ + peer.c \ +- plugin.c \ + program.c \ + regex.c \ + resolver_api.c resolver.h \ diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c index ac4779f..3e100cc 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c @@ -162,7 +162,7 @@ struct GNUNET_ATS_Session /** * ATS network type. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; }; @@ -704,7 +704,7 @@ client_connect (struct GNUNET_ATS_Session *s) * @param session the session * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_client_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -719,7 +719,7 @@ http_client_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_client_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -784,7 +784,7 @@ http_client_plugin_get_session (void *cls, struct HTTP_Client_Plugin *plugin = cls; struct GNUNET_ATS_Session *s; struct sockaddr *sa; - enum GNUNET_ATS_Network_Type net_type; + enum GNUNET_NetworkType net_type; size_t salen = 0; int res; @@ -806,7 +806,7 @@ http_client_plugin_get_session (void *cls, } /* Determine network location */ - net_type = GNUNET_ATS_NET_UNSPECIFIED; + net_type = GNUNET_NT_UNSPECIFIED; sa = http_common_socket_from_address (address->address, address->address_length, &res); if (GNUNET_SYSERR == res) return NULL; @@ -827,9 +827,9 @@ http_client_plugin_get_session (void *cls, else if (GNUNET_NO == res) { /* Cannot convert to sockaddr -> is external hostname */ - net_type = GNUNET_ATS_NET_WAN; + net_type = GNUNET_NT_WAN; } - if (GNUNET_ATS_NET_UNSPECIFIED == net_type) + if (GNUNET_NT_UNSPECIFIED == net_type) { GNUNET_break (0); return NULL; diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc.c b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc.c index f20e3b1..d627a68 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc.c +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc.c @@ -281,11 +281,11 @@ webrtc_plugin_query_keepalive_factor (void *cls) * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType webrtc_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { - return GNUNET_ATS_NET_WAN; + return GNUNET_NT_WAN; } @@ -296,11 +296,11 @@ webrtc_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType webrtc_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { - return GNUNET_ATS_NET_WAN; + return GNUNET_NT_WAN; } @@ -589,7 +589,6 @@ webrtc_plugin_get_session (void *cls, s, &address->peer, &plugin->port, - GNUNET_CADET_OPTION_RELIABLE, out_window_change_cb, out_disconnect_cb, handlers); -- cgit v1.2.3-18-g5258