From b6a94c7c11831398e06597f4c804b65ce2b7d885 Mon Sep 17 00:00:00 2001 From: John Jones Date: Sun, 19 Mar 2017 08:04:54 -0500 Subject: [PATCH] Implemeting NodeIO --- Makefile | 3 +++ include/libp2p/nodeio/nodeio.h | 6 ++++++ nodeio/Makefile | 18 ++++++++++++++++++ nodeio/nodeio.c | 10 ++++++++++ 4 files changed, 37 insertions(+) create mode 100644 include/libp2p/nodeio/nodeio.h create mode 100644 nodeio/Makefile create mode 100644 nodeio/nodeio.c diff --git a/Makefile b/Makefile index 7c3a32d..0ceaaae 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ OBJS = \ thirdparty/mbedtls/*.o \ hashmap/hashmap.o \ net/*.o \ + nodeio/*.o \ peer/*.o \ record/*.o \ routing/*.o \ @@ -24,6 +25,7 @@ compile: cd thirdparty; make all; cd hashmap; make all; cd net; make all; + cd nodeio; make all; cd peer; make all; cd record; make all; cd routing; make all; @@ -42,6 +44,7 @@ clean: cd crypto; make clean; cd hashmap; make clean; cd net; make clean; + cd nodeio; make clean; cd peer; make clean; cd thirdparty; make clean cd record; make clean; diff --git a/include/libp2p/nodeio/nodeio.h b/include/libp2p/nodeio/nodeio.h new file mode 100644 index 0000000..58058db --- /dev/null +++ b/include/libp2p/nodeio/nodeio.h @@ -0,0 +1,6 @@ +#pragma once + +#include "libp2p/net/stream.h" + +int libp2p_nodeio_upgrade_stream(struct Stream* stream); +struct Node* libp2p_nodeio_get(struct Stream* stream, unsigned char* hash, int hash_length); diff --git a/nodeio/Makefile b/nodeio/Makefile new file mode 100644 index 0000000..b3e63f4 --- /dev/null +++ b/nodeio/Makefile @@ -0,0 +1,18 @@ +CC = gcc +CFLAGS = -O0 -Wall -I../include -I../../c-protobuf + +ifdef DEBUG +CFLAGS += -g3 +endif + +LFLAGS = +DEPS = +OBJS = nodeio.o + +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +all: $(OBJS) + +clean: + rm -f *.o diff --git a/nodeio/nodeio.c b/nodeio/nodeio.c new file mode 100644 index 0000000..f0a7ccd --- /dev/null +++ b/nodeio/nodeio.c @@ -0,0 +1,10 @@ +#include +#include "libp2p/net/stream.h" + +int libp2p_nodeio_upgrade_stream(struct Stream* stream) { + return 0; +} + +struct Node* libp2p_nodeio_get(struct Stream* stream, unsigned char* hash, int hash_length) { + return NULL; +}