From 81d22522293443a377374fef74710a3f52ef7650 Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Wed, 20 Sep 2017 07:53:36 -0500 Subject: [PATCH] Now compiling with api changes --- core/api.c | 7 ++++--- importer/exporter.c | 7 +++++++ include/ipfs/importer/exporter.h | 9 +++++++++ test/core/test_api.h | 1 + test/routing/test_routing.h | 3 +-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/core/api.c b/core/api.c index 16237b8..5ef1c08 100644 --- a/core/api.c +++ b/core/api.c @@ -14,6 +14,7 @@ #include #include "libp2p/net/p2pnet.h" +#include "libp2p/os/memstream.h" #include "libp2p/utils/logger.h" #include "ipfs/core/api.h" #include "ipfs/importer/exporter.h" @@ -303,16 +304,16 @@ int get_object(struct IpfsNode* local_node, char *path, unsigned char **obj, siz } // throw everything (including links) into the memory stream - ifps_exporter_cat_node(read_node, local_node, memstream_file); + ipfs_exporter_cat_node(read_node, local_node, memstream_file); fclose(memstream_file); // no longer need these ipfs_cid_free(cid); - libp2p_hashtable_node_free(read_node); + ipfs_hashtable_node_free(read_node); *size = memstream_size; - *obj = memstream_char; + *obj = (unsigned char*)memstream_char; return 1; } diff --git a/importer/exporter.c b/importer/exporter.c index 178cb3b..89d964e 100644 --- a/importer/exporter.c +++ b/importer/exporter.c @@ -208,6 +208,13 @@ int ipfs_exporter_object_get(int argc, char** argv) { return retVal; } +/** + * rebuild a file based on this HashtableNode, traversing links + * @param node the HashtableNode to start with + * @param local_node the context + * @param file the filestream to fill + * @returns true(1) on success, false(0) otherwise + */ int ipfs_exporter_cat_node(struct HashtableNode* node, struct IpfsNode* local_node, FILE *file) { // process this node, then move on to the links diff --git a/include/ipfs/importer/exporter.h b/include/ipfs/importer/exporter.h index dab92fe..8dfe4b2 100644 --- a/include/ipfs/importer/exporter.h +++ b/include/ipfs/importer/exporter.h @@ -43,3 +43,12 @@ int ipfs_exporter_object_cat(int argc, char** argv); * @returns true(1) on success, false(0) otherwise */ int ipfs_exporter_object_cat_to_file(struct IpfsNode *local_node, unsigned char* hash, int hash_size, FILE* file); + +/** + * rebuild a file based on this HashtableNode, traversing links + * @param node the HashtableNode to start with + * @param local_node the context + * @param file the filestream to fill + * @returns true(1) on success, false(0) otherwise + */ +int ipfs_exporter_cat_node(struct HashtableNode* node, struct IpfsNode* local_node, FILE *file); diff --git a/test/core/test_api.h b/test/core/test_api.h index 3ff7e87..1a1ae87 100644 --- a/test/core/test_api.h +++ b/test/core/test_api.h @@ -1,3 +1,4 @@ +#include "../test_helper.h" #include "ipfs/core/api.h" #include "libp2p/utils/logger.h" diff --git a/test/routing/test_routing.h b/test/routing/test_routing.h index 84a6d7a..dbfe338 100644 --- a/test/routing/test_routing.h +++ b/test/routing/test_routing.h @@ -56,7 +56,7 @@ int test_routing_put_value() { // wait for everything to fire up sleep(5); - /* this area is for when we get the command line interface closer to completion... So skip for now and do it at a lower level + /* this area is for when we get the command line interface closer to completion... So skip for now // now "publish" to publisher, and verify that "consumer" receives the message char* args2[] = {"ipfs" "--config", ipfs_path_publisher, "name", "publish", "QmZtAEqmnXMZkwVPKdyMGxUoo35cQMzNhmq6CN3DvgRwAD" }; @@ -71,7 +71,6 @@ int test_routing_put_value() { //ipfs_resolve(5, args3, &results); */ - ipfs_namesys_publisher_publish(); retVal = 1; exit: