gossipd: move files into connectd.

These source files are only used for peer-related things, so move them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-07-24 15:48:58 +09:30
parent 5c066b9a25
commit 0d442b5ff2
14 changed files with 51 additions and 29 deletions

View File

@ -15,10 +15,10 @@ LIGHTNINGD_CONNECT_CONTROL_OBJS := $(LIGHTNINGD_CONNECT_CONTROL_SRC:.c=.o)
LIGHTNINGD_CONNECT_HEADERS := connectd/gen_connect_wire.h \ LIGHTNINGD_CONNECT_HEADERS := connectd/gen_connect_wire.h \
connectd/gen_connect_gossip_wire.h \ connectd/gen_connect_gossip_wire.h \
connectd/connect.h \ connectd/connect.h \
gossipd/handshake.h \ connectd/handshake.h \
gossipd/netaddress.h \ connectd/netaddress.h \
gossipd/tor_autoservice.h \ connectd/tor_autoservice.h \
gossipd/tor.h connectd/tor.h
LIGHTNINGD_CONNECT_SRC := $(LIGHTNINGD_CONNECT_HEADERS:.h=.c) LIGHTNINGD_CONNECT_SRC := $(LIGHTNINGD_CONNECT_HEADERS:.h=.c)
LIGHTNINGD_CONNECT_OBJS := $(LIGHTNINGD_CONNECT_SRC:.c=.o) LIGHTNINGD_CONNECT_OBJS := $(LIGHTNINGD_CONNECT_SRC:.c=.o)

View File

@ -33,12 +33,12 @@
#include <connectd/connect.h> #include <connectd/connect.h>
#include <connectd/gen_connect_gossip_wire.h> #include <connectd/gen_connect_gossip_wire.h>
#include <connectd/gen_connect_wire.h> #include <connectd/gen_connect_wire.h>
#include <connectd/handshake.h>
#include <connectd/netaddress.h>
#include <connectd/tor.h>
#include <connectd/tor_autoservice.h>
#include <errno.h> #include <errno.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_wire.h>
#include <gossipd/handshake.h>
#include <gossipd/netaddress.h>
#include <gossipd/tor.h>
#include <gossipd/tor_autoservice.h>
#include <hsmd/client.h> #include <hsmd/client.h>
#include <hsmd/gen_hsm_client_wire.h> #include <hsmd/gen_hsm_client_wire.h>
#include <inttypes.h> #include <inttypes.h>

View File

@ -11,8 +11,8 @@
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <common/utils.h> #include <common/utils.h>
#include <common/wireaddr.h> #include <common/wireaddr.h>
#include <connectd/handshake.h>
#include <errno.h> #include <errno.h>
#include <gossipd/handshake.h>
#include <hsmd/client.h> #include <hsmd/client.h>
#include <secp256k1.h> #include <secp256k1.h>
#include <secp256k1_ecdh.h> #include <secp256k1_ecdh.h>

View File

@ -1,5 +1,5 @@
#ifndef LIGHTNING_GOSSIPD_HANDSHAKE_H #ifndef LIGHTNING_CONNECTD_HANDSHAKE_H
#define LIGHTNING_GOSSIPD_HANDSHAKE_H #define LIGHTNING_CONNECTD_HANDSHAKE_H
#include "config.h" #include "config.h"
#include <ccan/typesafe_cb/typesafe_cb.h> #include <ccan/typesafe_cb/typesafe_cb.h>
@ -51,4 +51,4 @@ struct io_plan *responder_handshake_(struct io_conn *conn,
void *cbarg), void *cbarg),
void *cbarg); void *cbarg);
#endif /* LIGHTNING_GOSSIPD_HANDSHAKE_H */ #endif /* LIGHTNING_CONNECTD_HANDSHAKE_H */

View File

@ -2,8 +2,8 @@
#include <assert.h> #include <assert.h>
#include <common/status.h> #include <common/status.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <connectd/netaddress.h>
#include <errno.h> #include <errno.h>
#include <gossipd/netaddress.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -1,5 +1,5 @@
#ifndef LIGHTNING_GOSSIPD_NETADDRESS_H #ifndef LIGHTNING_CONNECTD_NETADDRESS_H
#define LIGHTNING_GOSSIPD_NETADDRESS_H #define LIGHTNING_CONNECTD_NETADDRESS_H
#include "config.h" #include "config.h"
#include <ccan/short_types/short_types.h> #include <ccan/short_types/short_types.h>
#include <common/wireaddr.h> #include <common/wireaddr.h>
@ -11,4 +11,4 @@ bool guess_address(struct wireaddr *wireaddr);
bool address_routable(const struct wireaddr *wireaddr, bool address_routable(const struct wireaddr *wireaddr,
bool allow_localhost); bool allow_localhost);
#endif /* LIGHTNING_GOSSIPD_NETADDRESS_H */ #endif /* LIGHTNING_CONNECTD_NETADDRESS_H */

26
connectd/test/Makefile Normal file
View File

@ -0,0 +1,26 @@
check: connectd-tests
# Note that these actually #include everything they need, except ccan/ and bitcoin/.
# That allows for unit testing of statics, and special effects.
CONNECTD_TEST_SRC := $(wildcard connectd/test/run-*.c)
CONNECTD_TEST_OBJS := $(CONNECTD_TEST_SRC:.c=.o)
CONNECTD_TEST_PROGRAMS := $(CONNECTD_TEST_OBJS:.o=)
CONNECTD_TEST_COMMON_OBJS := \
common/features.o \
common/pseudorand.o \
common/type_to_string.o \
common/utils.o
update-mocks: $(CONNECTD_TEST_SRC:%=update-mocks/%)
$(CONNECTD_TEST_PROGRAMS): $(CONNECTD_TEST_COMMON_OBJS) $(BITCOIN_OBJS)
# Test objects depend on ../ src and headers.
$(CONNECTD_TEST_OBJS): $(LIGHTNINGD_CONNECT_HEADERS) $(LIGHTNINGD_CONNECT_SRC)
ALL_OBJS += $(CONNECTD_TEST_OBJS)
ALL_TEST_PROGRAMS += $(CONNECTD_TEST_PROGRAMS)
connectd-tests: $(CONNECTD_TEST_PROGRAMS:%=unittest/%)

View File

@ -4,8 +4,8 @@
#include <common/status.h> #include <common/status.h>
#include <common/utils.h> #include <common/utils.h>
#include <common/wireaddr.h> #include <common/wireaddr.h>
#include <gossipd/gossip.h> #include <connectd/connect.h>
#include <gossipd/tor.h> #include <connectd/tor.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -1,5 +1,5 @@
#ifndef LIGHTNING_GOSSIPD_TOR_H #ifndef LIGHTNING_CONNECTD_TOR_H
#define LIGHTNING_GOSSIPD_TOR_H #define LIGHTNING_CONNECTD_TOR_H
#include "config.h" #include "config.h"
#include <stdbool.h> #include <stdbool.h>
@ -13,4 +13,4 @@ struct io_plan *io_tor_connect(struct io_conn *conn,
const char *host, u16 port, const char *host, u16 port,
struct reaching *reach); struct reaching *reach);
#endif /* LIGHTNING_GOSSIPD_TOR_H */ #endif /* LIGHTNING_CONNECTD_TOR_H */

View File

@ -10,9 +10,9 @@
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <common/utils.h> #include <common/utils.h>
#include <common/wireaddr.h> #include <common/wireaddr.h>
#include <connectd/tor_autoservice.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <gossipd/tor_autoservice.h>
#include <lightningd/log.h> #include <lightningd/log.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@ -1,5 +1,5 @@
#ifndef LIGHTNING_GOSSIPD_TOR_AUTOSERVICE_H #ifndef LIGHTNING_CONNECTD_TOR_AUTOSERVICE_H
#define LIGHTNING_GOSSIPD_TOR_AUTOSERVICE_H #define LIGHTNING_CONNECTD_TOR_AUTOSERVICE_H
#include "config.h" #include "config.h"
#include <ccan/short_types/short_types.h> #include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h> #include <ccan/tal/tal.h>
@ -11,4 +11,4 @@ struct wireaddr *tor_autoservice(const tal_t *ctx,
const char *tor_password, const char *tor_password,
const struct wireaddr_internal *bindings); const struct wireaddr_internal *bindings);
#endif /* LIGHTNING_GOSSIPD_TOR_AUTOSERVICE_H */ #endif /* LIGHTNING_CONNECTD_TOR_AUTOSERVICE_H */

View File

@ -36,11 +36,7 @@
#include <gossipd/broadcast.h> #include <gossipd/broadcast.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_wire.h>
#include <gossipd/gossip.h> #include <gossipd/gossip.h>
#include <gossipd/handshake.h>
#include <gossipd/netaddress.h>
#include <gossipd/routing.h> #include <gossipd/routing.h>
#include <gossipd/tor.h>
#include <gossipd/tor_autoservice.h>
#include <hsmd/client.h> #include <hsmd/client.h>
#include <hsmd/gen_hsm_client_wire.h> #include <hsmd/gen_hsm_client_wire.h>
#include <inttypes.h> #include <inttypes.h>