From 91012d9af758a48c4c57fc940dfcc8a581fa46ac Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 14 Feb 2018 13:55:00 +0100 Subject: build: Allow out-of-tree build of tools This removes the dependencies for the tools on some ouroboros internal headers (endian.h and time_utils.h) so they can be built out-of-tree. The echo-app tool has been renamed oecho and the cbr tool has been renamed ocbr. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/tools/oping/oping_client.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'src/tools/oping/oping_client.c') diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 8952f5ed..07fbde74 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -36,18 +36,6 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - volatile bool stop; void shutdown_client(int signo, siginfo_t * info, void * c) @@ -88,12 +76,12 @@ void * reader(void * o) if (msg_len < 0) continue; - if (ntoh32(msg->type) != ECHO_REPLY) { + if (ntohl(msg->type) != ECHO_REPLY) { printf("Invalid message on fd %d.\n", fd); continue; } - if (ntoh32(msg->id) >= client.count) { + if ((uint32_t) ntohl(msg->id) >= client.count) { printf("Invalid id.\n"); continue; } @@ -102,8 +90,8 @@ void * reader(void * o) clock_gettime(CLOCK_MONOTONIC, &now); - sent.tv_sec = ntoh64(msg->tv_sec); - sent.tv_nsec = ntoh64(msg->tv_nsec); + sent.tv_sec = msg->tv_sec; + sent.tv_nsec = msg->tv_nsec; ms = ts_diff_us(&sent, &now) / 1000.0; @@ -155,10 +143,10 @@ void * writer(void * o) clock_gettime(CLOCK_MONOTONIC, &now); - msg->type = hton32(ECHO_REQUEST); - msg->id = hton32(client.sent++); - msg->tv_sec = hton64(now.tv_sec); - msg->tv_nsec = hton64(now.tv_nsec); + msg->type = htonl(ECHO_REQUEST); + msg->id = htonl(client.sent++); + msg->tv_sec = now.tv_sec; + msg->tv_nsec = now.tv_nsec; if (flow_write(*fdp, buf, client.size) == -1) { printf("Failed to send SDU.\n"); -- cgit v1.2.3