Now compiling with api changes

This commit is contained in:
jmjatlanta 2017-09-20 07:53:36 -05:00
parent 794217ed6c
commit 81d2252229
5 changed files with 22 additions and 5 deletions

View file

@ -14,6 +14,7 @@
#include <fcntl.h> #include <fcntl.h>
#include "libp2p/net/p2pnet.h" #include "libp2p/net/p2pnet.h"
#include "libp2p/os/memstream.h"
#include "libp2p/utils/logger.h" #include "libp2p/utils/logger.h"
#include "ipfs/core/api.h" #include "ipfs/core/api.h"
#include "ipfs/importer/exporter.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 // 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); fclose(memstream_file);
// no longer need these // no longer need these
ipfs_cid_free(cid); ipfs_cid_free(cid);
libp2p_hashtable_node_free(read_node); ipfs_hashtable_node_free(read_node);
*size = memstream_size; *size = memstream_size;
*obj = memstream_char; *obj = (unsigned char*)memstream_char;
return 1; return 1;
} }

View file

@ -208,6 +208,13 @@ int ipfs_exporter_object_get(int argc, char** argv) {
return retVal; 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) { int ipfs_exporter_cat_node(struct HashtableNode* node, struct IpfsNode* local_node, FILE *file) {
// process this node, then move on to the links // process this node, then move on to the links

View file

@ -43,3 +43,12 @@ int ipfs_exporter_object_cat(int argc, char** argv);
* @returns true(1) on success, false(0) otherwise * @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); 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);

View file

@ -1,3 +1,4 @@
#include "../test_helper.h"
#include "ipfs/core/api.h" #include "ipfs/core/api.h"
#include "libp2p/utils/logger.h" #include "libp2p/utils/logger.h"

View file

@ -56,7 +56,7 @@ int test_routing_put_value() {
// wait for everything to fire up // wait for everything to fire up
sleep(5); 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 // now "publish" to publisher, and verify that "consumer" receives the message
char* args2[] = {"ipfs" "--config", ipfs_path_publisher, "name", "publish", "QmZtAEqmnXMZkwVPKdyMGxUoo35cQMzNhmq6CN3DvgRwAD" }; 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_resolve(5, args3, &results);
*/ */
ipfs_namesys_publisher_publish();
retVal = 1; retVal = 1;
exit: exit: