Compare commits

...

10 Commits

Author SHA1 Message Date
Jose Marcial Vieira Bisneto d0c319a88c
Merge branch 'raduiliescu83-master' 2019-01-02 11:42:48 -03:00
Jose Marcial Vieira Bisneto 64a2a902db
Merge branch 'master' of git://github.com/raduiliescu83/c-libp2p into raduiliescu83-master 2019-01-02 11:25:59 -03:00
Agorise 1175378fb0
Update LICENSE 2019-01-01 10:42:03 -06:00
Radu Iliescu 3e35485820 Update multihash subproject 2018-12-05 08:52:11 -05:00
Radu Iliescu 797e4462d6 gitignore: ignore .so.* files 2018-12-03 09:25:35 -05:00
Radu Iliescu 2949b2468f Makefile: build libp2p as shared library 2018-12-03 09:24:50 -05:00
Radu Iliescu d386a4b496 build: fix all build warnings 2018-12-03 08:20:51 -05:00
Radu Iliescu 29d7a412fe gitignore: add cscope files in gitignore 2018-12-03 08:20:00 -05:00
Radu Iliescu f60d6560b1 Makefile: change the test build target - no more cd 2018-12-03 07:31:01 -05:00
Radu Iliescu 83c97bab78 Makefile: make first build targe all
Otherwise when you give make command it will do just link
2018-12-03 07:24:15 -05:00
13 changed files with 28 additions and 26 deletions

4
.gitignore vendored
View File

@ -5,4 +5,8 @@
*.o
.settings/language.settings.xml
*.a
*.so
*.so.*
test/testit_libp2p
cscope.files
cscope.out

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "c-multiaddr"]
path = c-multiaddr
url = https://github.com/raduiliescu83/c-multiaddr.git
url = https://github.com/Agorise/c-multiaddr.git
[submodule "c-multihash"]
path = c-multihash
url = https://github.com/raduiliescu83/c-multihash.git
url = https://github.com/Agorise/c-multihash.git
[submodule "c-protobuf"]
path = c-protobuf
url = https://github.com/raduiliescu83/c-protobuf.git
url = https://github.com/Agorise/c-protobuf.git

View File

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

View File

@ -1,10 +1,12 @@
SUBMODULES = c-multiaddr c-multihash c-protobuf
COMPONENTS = conn crypto db thirdparty hashmap identify net os peer record routing secio swarm utils yamux
export DEBUG = true
export SHARED = true
ROOT= $(shell pwd)
export INCLUDE = -I$(ROOT)/include -I$(ROOT)/c-protobuf -I$(ROOT)/c-multihash/include -I$(ROOT)/c-multiaddr/include
export CFLAGS = $(INCLUDE) -Wall -O0
export CFLAGS = $(INCLUDE) -Wall -O0 -fPIC
ifdef DEBUG
CFLAGS += -g3
@ -13,19 +15,24 @@ endif
OBJS = $(shell (find $(COMPONENTS) -name *.o))
all: test
link: compile
$(AR) rcs libp2p.a $(OBJS) $(LINKER_FLAGS)
#ifdef SHARED
gcc -shared -o libp2p.so $(OBJS) $(LINKER_FLAGS)
#endif
compile:
$(foreach dir,$(SUBMODULES), $(MAKE) -C $(dir) all ;)
$(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) all ;)
test: compile link
cd test; make all;
test: link
make -C test all;
rebuild: clean all
all: test
clean:
$(foreach dir,$(SUBMODULES), $(MAKE) -C $(dir) clean ;)
$(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) clean ;)
make -C test clean

@ -1 +1 @@
Subproject commit a271e08996337eaadede798d785d18ec9515fd42
Subproject commit b1f7d607eef3928d7153e87c2b551e0c713588df

@ -1 +1 @@
Subproject commit bc6c0830136d39c87b9f59a335d096db882418f6
Subproject commit 3a7a71c7fdbbea60498d25a27d9fd63d57f507c0

@ -1 +1 @@
Subproject commit dceaa020823be04c9ed54fec8fb8b2537f440d26
Subproject commit 1472282e313d65afd2a3884bcab9df7c39928c05

View File

@ -26,7 +26,6 @@ struct TransportDialer* libp2p_conn_tcp_transport_dialer_new();
* @returns a new Dialer struct
*/
struct Dialer* libp2p_conn_dialer_new(struct Libp2pPeer* peer, struct Peerstore* peerstore, struct RsaPrivateKey* rsa_private_key, struct SwarmContext* swarm) {
int success = 0;
struct Dialer* dialer = (struct Dialer*)malloc(sizeof(struct Dialer));
if (dialer != NULL) {
dialer->peerstore = peerstore;
@ -166,7 +165,7 @@ int libp2p_conn_dialer_join_swarm(const struct Dialer* dialer, struct Libp2pPeer
return 0;
}
// then get an identify
struct Stream* identify_stream = libp2p_identify_stream_new(yamux_multistream, identify, 1);
libp2p_identify_stream_new(yamux_multistream, identify, 1);
}
} else {
libp2p_logger_error("dialer", "Expected a yamux context, but got a context of type %d.\n", peer->sessionContext->default_stream->stream_type);

View File

@ -4,7 +4,7 @@
#include <stddef.h>
struct RsaPublicKey {
char* der;
unsigned char* der;
size_t der_length;
};
@ -20,7 +20,7 @@ struct RsaPrivateKey {
unsigned long long N;
// the keys in DER format
// private
char* der;
unsigned char* der;
size_t der_length;
// public
char* public_key_der;

View File

@ -256,9 +256,7 @@ int libp2p_peer_protobuf_decode(unsigned char* in, size_t in_size, struct Libp2p
int retVal = 0;
char* buffer = NULL;
size_t buffer_size = 0;
struct Libp2pLinkedList* current = NULL;
struct Libp2pLinkedList* last = NULL;
struct MultiAddress* ma = NULL;
*out = libp2p_peer_new();
if ( *out == NULL)

View File

@ -302,11 +302,6 @@ static int parse_message(const unsigned char *buf, int buflen,
int *want_return);
static const unsigned char zeroes[20] = {0};
static const unsigned char ones[20] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
static const unsigned char v4prefix[16] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0
};

View File

@ -334,7 +334,6 @@ int libp2p_routing_dht_handle_add_provider(struct Stream* stream, struct Kademli
int libp2p_routing_dht_handle_get_value(struct Stream* stream, struct KademliaMessage* message, struct DhtContext* dht_context,
unsigned char** result_buffer, size_t *result_buffer_size) {
struct Datastore* datastore = dht_context->datastore;
struct Filestore* filestore = dht_context->filestore;
size_t data_size = 0;
unsigned char* data = NULL;

View File

@ -314,7 +314,7 @@ int libp2p_secio_verify_signature(struct PublicKey* public_key, const unsigned c
if (public_key->type == KEYTYPE_RSA) {
struct RsaPublicKey rsa_key = {0};
rsa_key.der = (char*)public_key->data;
rsa_key.der = public_key->data;
rsa_key.der_length = public_key->data_size;
return libp2p_crypto_rsa_verify(&rsa_key, in, in_length, signature);
}
@ -335,7 +335,7 @@ int libp2p_secio_sign(struct PrivateKey* private_key, const char* in, size_t in_
if (private_key->type == KEYTYPE_RSA) {
struct RsaPrivateKey rsa_key = {0};
rsa_key.der = (char*)private_key->data;
rsa_key.der = private_key->data;
rsa_key.der_length = private_key->data_size;
int retVal = libp2p_crypto_rsa_sign(&rsa_key, in, in_length, signature, signature_size);
// debugging