summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping_client.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-02-14 13:55:00 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-02-14 17:58:51 +0100
commit91012d9af758a48c4c57fc940dfcc8a581fa46ac (patch)
tree96495c10b615ddafa94ebcfa1a0977109ec0ffe8 /src/tools/oping/oping_client.c
parente095d0ade3035c714768266755c9c61acfc2ad0f (diff)
downloadouroboros-91012d9af758a48c4c57fc940dfcc8a581fa46ac.tar.gz
ouroboros-91012d9af758a48c4c57fc940dfcc8a581fa46ac.zip
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 <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/tools/oping/oping_client.c')
-rw-r--r--src/tools/oping/oping_client.c28
1 files changed, 8 insertions, 20 deletions
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 <ouroboros/dev.h>
-#include <ouroboros/fccntl.h>
-#include <ouroboros/time_utils.h>
-
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <arpa/inet.h>
-#include <math.h>
-#include <errno.h>
-#include <float.h>
-
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");