add ping
This commit is contained in:
1 parent
389124d327
commit
ffbc0da86f
12 files changed
+681
-29
No files matched your search
@@ -23,6 +23,7 @@ check_PROGRAMS = \
|
||||
test_bgp_route_exchange \
|
||||
test_routing_mesh \
|
||||
test_etcp_ping \
|
||||
test_route_ping \
|
||||
bench_timeout_heap \
|
||||
bench_uasync_timeouts
|
||||
|
||||
@@ -81,6 +82,7 @@ ETCP_FULL_OBJS = \
|
||||
$(top_builddir)/src/utun-config_updater.o \
|
||||
$(top_builddir)/src/utun-route_lib.o \
|
||||
$(top_builddir)/src/utun-route_bgp.o \
|
||||
$(top_builddir)/src/utun-route_ping.o \
|
||||
$(top_builddir)/src/utun-route_node.o \
|
||||
$(top_builddir)/src/utun-routing.o \
|
||||
$(top_builddir)/src/utun-tun_if.o \
|
||||
@@ -173,6 +175,10 @@ test_etcp_ping_SOURCES = test_etcp_ping.c
|
||||
test_etcp_ping_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source
|
||||
test_etcp_ping_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS)
|
||||
|
||||
test_route_ping_SOURCES = test_route_ping.c
|
||||
test_route_ping_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_srcdir)/tinycrypt/lib/include -I$(top_srcdir)/tinycrypt/lib/source
|
||||
test_route_ping_LDADD = $(ETCP_FULL_OBJS) $(SECURE_CHANNEL_OBJS) $(CRYPTO_LIBS) $(COMMON_LIBS)
|
||||
|
||||
test_ll_queue_SOURCES = test_ll_queue.c
|
||||
test_ll_queue_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib
|
||||
test_ll_queue_LDADD = $(COMMON_LIBS)
|
||||
|
||||
@@ -128,11 +128,15 @@ static void test_timeout(void* arg) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ping_callback(int success, void* arg, uint64_t nonce) {
|
||||
static void ping_callback(int success, uint16_t rtt, void* arg, uint64_t nonce,
|
||||
const uint8_t* resp_data, size_t resp_data_len) {
|
||||
(void)rtt;
|
||||
(void)arg;
|
||||
(void)nonce;
|
||||
(void)resp_data;
|
||||
(void)resp_data_len;
|
||||
pong_received = success;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "ping_callback: success=%d", success);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "ping_callback: success=%d rtt=%u", success, (unsigned)rtt);
|
||||
test_completed = 1;
|
||||
}
|
||||
|
||||
@@ -180,7 +184,7 @@ int main(void) {
|
||||
struct ETCP_LINK* link = conn->links;
|
||||
uint8_t peer_pubkey[SC_PUBKEY_SIZE];
|
||||
memcpy(peer_pubkey, link->etcp->crypto_ctx.peer_public_key, SC_PUBKEY_SIZE);
|
||||
ret = etcp_send_ping(client_instance, peer_pubkey, &link->remote_addr, 500, ping_callback, NULL);
|
||||
ret = etcp_send_ping(client_instance, peer_pubkey, &link->remote_addr, 500, ping_callback, NULL, NULL, 0);
|
||||
if (ret == 0) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "ping sent via real link");
|
||||
test_completed = 0;
|
||||
|
||||
Reference in new issue
Block a user