Compare commits

...

10 Commits

47 changed files with 155 additions and 67 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,3 @@
# These are supported funding model platforms
custom: https://www.blockchain.com/btc/payment_request?address=1AFGT5gVj7xhfjgHTuwEoaV56WTCh7Gjf1#BITCOIN_ONLY

7
.gitmodules vendored Normal file
View File

@ -0,0 +1,7 @@
[submodule "c-libp2p"]
path = c-libp2p
url = https://github.com/Agorise/c-libp2p.git
[submodule "lmdb"]
path = lmdb
url = https://github.com/jmjatlanta/lmdb.git
branch = mdb.master

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 AGORISE, LTD.
Copyright (c) 2019 AGORISE, LTD.
An International Business Company, Cyprus Reg# ΗΕ375959
Contains works from BitShares Munich IVS

View File

@ -3,7 +3,8 @@ DEBUG = true
export DEBUG
all:
#cd ../c-libp2p; make all;
cd c-libp2p; make all;
cd lmdb/libraries/liblmdb; make all;
cd blocks; make all;
cd cid; make all;
cd cmd; make all;
@ -27,8 +28,10 @@ all:
cd util; make all;
cd main; make all;
cd test; make all;
clean:
cd c-libp2p; make clean;
cd lmdb/libraries/liblmdb; make clean;
cd blocks; make clean;
cd cid; make clean;
cd cmd; make clean;

View File

@ -12,7 +12,7 @@ IPFS implementation in C, (not just an API client library).
* [getting started](https://github.com/ipfs/community/issues/177)
* [libp2p](https://github.com/libp2p/specs)
## Prerequisites: To compile the C version you will need:
## Prerequisites: To compile the C version you will need, all included as submodules:
* [lmdb](https://github.com/jmjatlanta/lmdb)
* [c-protobuf](https://github.com/Agorise/c-protobuf)
* [c-multihash](https://github.com/Agorise/c-multihash)
@ -21,4 +21,8 @@ IPFS implementation in C, (not just an API client library).
And of course this project at https://github.com/Agorise/c-ipfs
The compilation at this point is simple, but not very flexible. Place all of these projects in a directory. Compile all (the order above is recommended) by going into each one and running "make all".
## How to compile the C version:
```
git submodule update --init --recursive
make all
```

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

1
c-libp2p Submodule

@ -0,0 +1 @@
Subproject commit d0c319a88cd1f2cb3a219420b5a0b930e72562e2

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3
@ -20,4 +20,4 @@ all: $(OBJS)
clean:
rm -f *.o
cd ipfs; make clean;
cd ipfs; make clean;

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multiaddr/include -I../../../c-protobuf -Wall
CFLAGS = -O0 -I../../include -I../../c-libp2p/include -I../../c-libp2p/c-multiaddr/include -I../../c-libp2p/c-protobuf -Wall
ifdef DEBUG
CFLAGS += -g3
@ -19,4 +19,4 @@ all: $(OBJS)
clean:
rm -f *.o
rm -f ipfs
rm -f ipfs

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -Wall -std=gnu99
LFLAGS =
DEPS = ../include/ipfs/commands/argument.h ../include/ipfs/commands/command_option.h \
../include/ipfs/commands/command.h ../include/ipfs/commands/context.h \

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -Wall
CFLAGS = -O0 -I../../include -I../../c-libp2p/include -Wall
LFLAGS =
DEPS = parse.h
OBJS = parse.o

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multiaddr/include -I../../c-protobuf -Wall -std=c11
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -750,7 +750,7 @@ int api_start (struct IpfsNode* local_node, int max_conns, int timeout)
return 0;
}
libp2p_logger_debug("api", "Started API on localhost port %d.\n", port);
libp2p_logger_info("api", "API server listening on %d.\n", port);
return 1;
}

View File

@ -70,8 +70,9 @@ int ipfs_daemon (int argc, char **argv)
{
char* repo_path = NULL;
libp2p_logger_add_class("daemon");
if (!ipfs_repo_get_directory(argc, argv, &repo_path)) {
fprintf(stderr, "Unable to open repo: %s\n", repo_path);
libp2p_logger_error("daemon", "Unable to open repo: %s\n", repo_path);
return 0;
}

View File

@ -47,7 +47,7 @@ struct Libp2pVector* ipfs_node_online_build_protocol_handlers(struct IpfsNode* n
// yamux
libp2p_utils_vector_add(retVal, libp2p_yamux_build_protocol_handler());
// identify
libp2p_utils_vector_add(retVal, libp2p_identify_build_protocol_handler(retVal));
libp2p_utils_vector_add(retVal, libp2p_identify_build_protocol_handler(node->identity->peer->id, node->identity->peer->id_size));
}
return retVal;
}

View File

@ -165,7 +165,7 @@ void* ipfs_null_listen (void *ptr)
return (void*) 2;
}
libp2p_logger_error("null", "Ipfs listening on %d\n", listen_param->port);
libp2p_logger_info("null", "Ipfs listening on %d\n", listen_param->port);
// when we have nothing to do, check on the connections to see if we're still connected
struct Libp2pLinkedList* current_peer_entry = NULL;

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../lmdb/libraries/liblmdb -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../lmdb/libraries/liblmdb -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multiaddr/include -I../../../c-multihash/include -I../../../c-protobuf -Wall -std=c99
CFLAGS = -O0 -I../../include -I../../c-libp2p/include -I../../c-libp2p/c-multiaddr/include -I../../c-libp2p/c-multihash/include -I../../c-libp2p/c-protobuf -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,6 +1,6 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall -std=c11
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -11,6 +11,8 @@
#include "ipfs/repo/init.h"
#include "ipfs/core/ipfs_node.h"
#include "libp2p/utils/logger.h"
#include "ipfs/namesys/name.h"
#include "ipfs/repo/fsrepo/jsmn.h"
/**
* pull objects from ipfs
@ -286,8 +288,23 @@ int ipfs_exporter_object_cat(struct CliArguments* args, FILE* output_file) {
}
if (local_node->mode == MODE_API_AVAILABLE) {
const char ipns_prefix[] = "/ipns/";
const char ipfs_prefix[] = "/ipfs/";
char* hash = args->argv[args->verb_index + 1];
libp2p_logger_debug("exporter", "We're attempting to use the API for this object get of %s.\n", hash);
if (memcmp(hash, ipfs_prefix, sizeof(ipfs_prefix)-1) == 0) {
// skip ipfs_prefix;
hash += sizeof(ipfs_prefix)-1;
} else if (memcmp(hash, ipns_prefix, sizeof(ipns_prefix)-1) == 0) {
char *response = NULL;
size_t response_size;
if (ipfs_name_resolve(local_node, hash, &response, &response_size) && response && response_size > 0) {
hash = jsmn_simple_parser(response, response_size, "Path");
if (!hash) {
return 0;
}
}
}
struct HttpRequest* request = ipfs_core_http_request_new();
char* response = NULL;
request->command = "object";

View File

@ -2,6 +2,16 @@
#include "ipfs/cmd/cli.h"
/***
* Publish IPNS name
*/
int ipfs_name_publish(struct IpfsNode* local_node, char* name, char **response, size_t *response_size);
/***
* Resolve IPNS name
*/
int ipfs_name_resolve(struct IpfsNode* local_node, char* name, char **response, size_t *response_size);
/**
* We received a cli command "ipfs name". Do the right thing.
* @param argc number of arguments on the command line

View File

@ -69,6 +69,7 @@ void jsmn_init(jsmn_parser *parser);
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens);
char *jsmn_simple_parser(char *full_json, int json_len, char *key);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multiaddr/include -I../../c-multihash/include -I../../c-protobuf -I../../lmdb/libraries/liblmdb -Wall -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-protobuf -I../lmdb/libraries/liblmdb -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

1
lmdb Submodule

@ -0,0 +1 @@
Subproject commit 6b62ada62a10b3185b2dcd51e512dea27e5e3c8e

View File

@ -1,6 +1,6 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -g3 -Wall -std=c99
LFLAGS = -L../../c-libp2p -L../../c-multihash -L../../c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread -lresolv -lcurl
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -g3 -Wall -std=gnu99
LFLAGS = -L../c-libp2p -L../c-libp2p/c-multihash -L../c-libp2p/c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread -lresolv -lcurl
DEPS = cmd/ipfs/test_init.h repo/test_repo_bootstrap_peers.h repo/test_repo_config.h repo/test_repo_identity.h cid/test_cid.h
OBJS = main.o \
../blocks/block.o ../blocks/blockstore.o \
@ -27,7 +27,7 @@ OBJS = main.o \
../routing/*.o \
../thirdparty/ipfsaddr/ipfs_addr.o \
../unixfs/unixfs.o \
../../c-protobuf/protobuf.o ../../c-protobuf/varint.o \
../c-libp2p/c-protobuf/protobuf.o ../c-libp2p/c-protobuf/varint.o \
../util/errs.o \
../util/time.o \
../util/thread_pool.o
@ -36,7 +36,7 @@ OBJS = main.o \
$(CC) -c -o $@ $< $(CFLAGS)
ipfs: $(OBJS)
$(CC) -o $@ $^ $(LFLAGS) ../../lmdb/libraries/liblmdb/liblmdb.a
$(CC) -o $@ $^ $(LFLAGS) ../lmdb/libraries/liblmdb/liblmdb.a
all: ipfs

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -11,39 +11,43 @@
/***
* Publish IPNS name
*/
int ipfs_name_publish(struct IpfsNode* local_node, char* name) {
int ipfs_name_publish(struct IpfsNode* local_node, char* name, char **response, size_t *response_size) {
// call api.
char* response = NULL;
struct HttpRequest* request = ipfs_core_http_request_new();
if (request == NULL)
return 0;
request->command = "name";
request->sub_command = "publish";
libp2p_utils_vector_add(request->arguments, name);
size_t response_size = 0;
int retVal = ipfs_core_http_request_post(local_node, request, &response, &response_size, "", 0);
if (response != NULL && response_size > 0) {
fwrite(response, 1, response_size, stdout);
free(response);
}
int retVal = ipfs_core_http_request_post(local_node, request, response, response_size, "", 0);
ipfs_core_http_request_free(request);
return retVal;
}
int ipfs_name_resolve(struct IpfsNode* local_node, char* name) {
/***
* Resolve IPNS name
*/
int ipfs_name_resolve(struct IpfsNode* local_node, char* name, char **response, size_t *response_size) {
// ask api
char* response = NULL;
const char prefix[] = "/ipns/";
char *ipns = NULL;
struct HttpRequest* request = ipfs_core_http_request_new();
if (request == NULL)
return 0;
request->command = "name";
request->sub_command = "resolve";
if (memcmp(name, prefix, sizeof(prefix)-1)!=0) {
ipns = malloc(sizeof(prefix) + strlen(name));
if (ipns) {
strcpy(ipns, prefix);
strcat(ipns, name);
name = ipns;
}
}
libp2p_utils_vector_add(request->arguments, name);
size_t response_size = 0;
int retVal = ipfs_core_http_request_post(local_node, request, &response, &response_size, "", 0);
if (response != NULL && response_size > 0) {
fwrite(response, 1, response_size, stdout);
free(response);
int retVal = ipfs_core_http_request_post(local_node, request, response, response_size, "", 0);
if (ipns) {
free(ipns);
}
ipfs_core_http_request_free(request);
return retVal;
@ -77,15 +81,21 @@ int ipfs_name(struct CliArguments* args) {
goto exit;
}
char *response = NULL;
size_t response_size;
// determine what we're doing
if (strcmp(which, "publish") == 0) {
retVal = ipfs_name_publish(client_node, path);
retVal = ipfs_name_publish(client_node, path, &response, &response_size);
} else if (strcmp(which, "resolve") == 0) {
retVal = ipfs_name_resolve(client_node, path);
retVal = ipfs_name_resolve(client_node, path, &response, &response_size);
} else {
libp2p_logger_error("name", "Nothing found on command line. Should be \"name resolve\" or \"name publish\".\n");
goto exit;
}
if (response != NULL && response_size > 0) {
fwrite(response, 1, response_size, stdout);
free(response);
}
exit:
// shut everything down

View File

@ -35,8 +35,6 @@ func NewNameSystem(r routing.ValueStore, ds ds.Datastore, cachesize int) NameSys
}
}*/
const int DefaultResolverCacheTTL = 60;
// ipfs_namesys_resolve implements Resolver.
int ipfs_namesys_resolve(char **path, char *name)
{

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../c-multiaddr/include -I../../../c-multihash/include -I../../../c-protobuf -Wall -std=c99
CFLAGS = -O0 -I../../include -I../../c-libp2p/include -I../../c-libp2p/c-multiaddr/include -I../../c-libp2p/c-multihash/include -I../../c-libp2p/c-protobuf -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include -I../../../lmdb/libraries/liblmdb -I../../../c-protobuf -I../../../c-multiaddr/include -Wall -std=c99
CFLAGS = -O0 -I../../include -I../../c-libp2p/include -I../../lmdb/libraries/liblmdb -I../../c-libp2p/c-protobuf -I../../c-libp2p/c-multiaddr/include -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3

View File

@ -13,7 +13,7 @@
#include "ipfs/repo/fsrepo/fs_repo.h"
#include "libp2p/os/utils.h"
#include "ipfs/repo/fsrepo/lmdb_datastore.h"
#include "jsmn.h"
#include "ipfs/repo/fsrepo/jsmn.h"
#include "multiaddr/multiaddr.h"
/**

View File

@ -1,4 +1,6 @@
#include "jsmn.h"
#include "ipfs/repo/fsrepo/jsmn.h"
#include <string.h>
#include <stdlib.h>
/**
* Allocates a fresh unused token from the token pull.
@ -311,3 +313,32 @@ void jsmn_init(jsmn_parser *parser) {
parser->toknext = 0;
parser->toksuper = -1;
}
char *jsmn_simple_parser(char *full_json, int json_len, char *key) {
int num_tokens = 256, len, i;
if (!full_json || !key) {
return NULL;
}
jsmn_parser parser;
jsmn_init(&parser);
jsmntok_t tokens[num_tokens];
num_tokens = jsmn_parse(&parser, full_json, json_len, tokens, 256);
if (num_tokens <= 0) {
return NULL;
}
len = strlen(key);
for (i = 0; i < num_tokens; i++) {
jsmntok_t curr_token = tokens[i];
if (len == (curr_token.end - curr_token.start) && memcmp(full_json + curr_token.start, key, len) == 0) {
curr_token = tokens[i+1];
len = curr_token.end - curr_token.start;
char *ret = malloc(len + 1);
if (!ret) {
return NULL;
}
strncpy(ret, full_json + curr_token.start, len);
return ret;
}
}
return NULL;
}

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multiaddr/include -I../../c-protobuf -Wall -std=c99
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,6 +1,6 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -I../../lmdb/libraries/liblmdb -g3 -Wall -std=c99
LFLAGS = -L../../c-libp2p -L../../c-multihash -L../../c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread -lcurl
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -I../lmdb/libraries/liblmdb -g3 -Wall -std=gnu99
LFLAGS = -L../c-libp2p -L../c-libp2p/c-multihash -L../c-libp2p/c-multiaddr -lp2p -lm -lmultihash -lmultiaddr -lpthread -lcurl
DEPS = cmd/ipfs/test_init.h repo/test_repo_bootstrap_peers.h repo/test_repo_config.h repo/test_repo_identity.h cid/test_cid.h
OBJS = testit.o test_helper.o \
../blocks/block.o ../blocks/blockstore.o \
@ -30,13 +30,13 @@ OBJS = testit.o test_helper.o \
../thirdparty/ipfsaddr/ipfs_addr.o \
../unixfs/unixfs.o \
../util/thread_pool.o \
../../c-protobuf/protobuf.o ../../c-protobuf/varint.o
../c-libp2p/c-protobuf/protobuf.o ../c-libp2p/c-protobuf/varint.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
test_ipfs: $(OBJS)
$(CC) -o $@ $^ $(LFLAGS) ../../lmdb/libraries/liblmdb/liblmdb.a
$(CC) -o $@ $^ $(LFLAGS) ../lmdb/libraries/liblmdb/liblmdb.a
all: test_ipfs

View File

@ -19,12 +19,13 @@ int test_compat_go_join_swarm() {
libp2p_logger_add_class("test_api");
libp2p_logger_add_class("identify");
libp2p_logger_add_class("null");
libp2p_logger_add_class("multistream");
libp2p_logger_add_class("swarm");
libp2p_logger_add_class("secio");
*/
libp2p_logger_add_class("dialer");
libp2p_logger_add_class("yamux");
libp2p_logger_add_class("multistream");
libp2p_logger_add_class("threadsafe_buffer");
// Here is the connection information for the GO version:
char* remote_string = "/ip4/10.211.55.2/tcp/4001/ipfs/QmacSE6bCZiAu7nrYkhPATaSoL2q9BszkKzbX6fCiXuBGA";

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../../include -I../../../c-libp2p/include
CFLAGS = -O0 -I../../include -I../../c-libp2p/include
LFLAGS =
DEPS =
OBJS = ipfs_addr.o

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3

View File

@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
CFLAGS = -O0 -I../include -I../c-libp2p/include -I../c-libp2p/c-multihash/include -I../c-libp2p/c-multiaddr/include -I../c-libp2p/c-protobuf -Wall -std=gnu99
ifdef DEBUG
CFLAGS += -g3