Implementing NodeIO

This commit is contained in:
John Jones 2017-03-19 08:05:25 -05:00
parent e8b8d06f24
commit 0b238eb5ac
5 changed files with 12 additions and 4 deletions

View file

@ -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);

View file

@ -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)

7
routing/supernode.c Normal file
View file

@ -0,0 +1,7 @@
#include <stdlib.h>
#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;
}

View file

@ -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

View file

@ -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