From 0b238eb5ace2d7d19f4360949c94fb518e7289ff Mon Sep 17 00:00:00 2001 From: John Jones Date: Sun, 19 Mar 2017 08:05:25 -0500 Subject: [PATCH] Implementing NodeIO --- include/ipfs/routing/routing.h | 2 +- routing/Makefile | 2 +- routing/supernode.c | 7 +++++++ test/Makefile | 1 + test/routing/test_supernode.h | 4 ++-- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 routing/supernode.c diff --git a/include/ipfs/routing/routing.h b/include/ipfs/routing/routing.h index c177ac5..1351036 100644 --- a/include/ipfs/routing/routing.h +++ b/include/ipfs/routing/routing.h @@ -85,4 +85,4 @@ int ipfs_routing_generic_put_value (ipfs_routing* offlineRouting, char *key, siz int ipfs_routing_generic_get_value (ipfs_routing* offlineRouting, char *key, size_t key_size, void **val, size_t *vlen); // supernode -int ipfs_routing_supernode_parse_provider(const unsigned char* in, struct Libp2pLinkedList** multiaddresses); +int ipfs_routing_supernode_parse_provider(const unsigned char* in, size_t in_size, struct Libp2pLinkedList** multiaddresses); diff --git a/routing/Makefile b/routing/Makefile index a23111e..ae6bbfc 100644 --- a/routing/Makefile +++ b/routing/Makefile @@ -7,7 +7,7 @@ endif LFLAGS = DEPS = -OBJS = offline.o online.o k_routing.o +OBJS = offline.o online.o k_routing.o supernode.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) diff --git a/routing/supernode.c b/routing/supernode.c new file mode 100644 index 0000000..bc8de0e --- /dev/null +++ b/routing/supernode.c @@ -0,0 +1,7 @@ +#include + +#include "libp2p/utils/linked_list.h" + +int ipfs_routing_supernode_parse_provider(unsigned char* in, size_t in_size, struct Libp2pLinkedList** multiadress_head) { + return 0; +} diff --git a/test/Makefile b/test/Makefile index 5fc0535..42b0afc 100644 --- a/test/Makefile +++ b/test/Makefile @@ -25,6 +25,7 @@ OBJS = testit.o test_helper.o \ ../routing/offline.o \ ../routing/online.o \ ../routing/k_routing.o \ + ../routing/supernode.o \ ../thirdparty/ipfsaddr/ipfs_addr.o \ ../unixfs/unixfs.o \ ../../c-protobuf/protobuf.o ../../c-protobuf/varint.o diff --git a/test/routing/test_supernode.h b/test/routing/test_supernode.h index 8b9bd23..ec7b6d2 100644 --- a/test/routing/test_supernode.h +++ b/test/routing/test_supernode.h @@ -88,7 +88,7 @@ int test_routing_supernode_get_value() { struct Libp2pLinkedList* multiaddress_head; // get an IP4 ip and port - if (!ipfs_routing_supernode_parse_provider(&results_buffer, &multiaddress_head)) + if (!ipfs_routing_supernode_parse_provider(results_buffer, results_size, &multiaddress_head)) goto exit; struct Libp2pLinkedList* current_address = multiaddress_head; @@ -110,7 +110,7 @@ int test_routing_supernode_get_value() { struct Stream* file_stream = libp2p_net_multistream_connect(ip, multiaddress_get_ip_port(addr)); // Switch from multistream to NodeIO - if (!libp2p_net_multistream_upgrade(file_stream, "/NodeIO/1.0.0")) + if (!libp2p_nodeio_upgrade_stream(file_stream)) goto exit; // Ask for file