summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-06-05 18:39:11 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-06-05 19:53:41 +0200
commitee9bfbed3726140d5601521de7ce8d003c453fb5 (patch)
tree615888154f56b315d742544725b50ad9736a290a /src/tools/oping/oping.c
parent85e8b0a4476fc0aff1b9192c36e807cb68f5320e (diff)
downloadouroboros-ee9bfbed3726140d5601521de7ce8d003c453fb5.tar.gz
ouroboros-ee9bfbed3726140d5601521de7ce8d003c453fb5.zip
tools: Support qosspecs in oping
The oping tool can now select a qos spec to use. Allowed specs are predefined an chosen using "raw", "best", "video" or "voice". 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.c')
-rw-r--r--src/tools/oping/oping.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c
index 08aa8d31..757bd422 100644
--- a/src/tools/oping/oping.c
+++ b/src/tools/oping/oping.c
@@ -42,6 +42,7 @@
#include <ouroboros/dev.h>
#include <ouroboros/fccntl.h>
#include <ouroboros/fqueue.h>
+#include <ouroboros/qos.h>
#include "time_utils.h"
@@ -66,11 +67,12 @@
#define OPING_MAX_FLOWS 256
struct c {
- char * s_apn;
- int interval;
- uint32_t count;
- int size;
- bool timestamp;
+ char * s_apn;
+ int interval;
+ uint32_t count;
+ int size;
+ bool timestamp;
+ qosspec_t qs;
/* stats */
uint32_t sent;
@@ -115,10 +117,11 @@ static void usage(void)
"and reports the Round Trip Time (RTT)\n\n"
" -l, --listen Run in server mode\n"
"\n"
- " -c, --count Number of packets (default 1000)\n"
- " -d, --duration Duration of the test\n"
- " -i, --interval Interval (ms, default 1000)\n"
+ " -c, --count Number of packets\n"
+ " -d, --duration Duration of the test (default 1s)\n"
+ " -i, --interval Interval (default 1000ms)\n"
" -n, --server-name Name of the oping server\n"
+ " -q, --qos QoS (raw, best, video or voice)\n"
" -s, --size Payload size (B, default 64)\n"
" -D, --timeofday Print time of day before each line"
"\n"
@@ -148,19 +151,21 @@ static int time_mul(const char * rem)
int main(int argc,
char ** argv)
{
- int ret = -1;
- char * rem = NULL;
- bool serv = false;
- long duration = 0;
+ int ret = -1;
+ char * rem = NULL;
+ bool serv = false;
+ long duration = 0;
+ char * qos = NULL;
argc--;
argv++;
- client.s_apn = NULL;
- client.interval = 1000;
- client.size = 64;
- client.count = 1000;
+ client.s_apn = NULL;
+ client.interval = 1000;
+ client.size = 64;
+ client.count = INT_MAX;
client.timestamp = false;
+ client.qs = qos_raw;
while (argc > 0) {
if (strcmp(*argv, "-i") == 0 ||
@@ -185,6 +190,10 @@ int main(int argc,
strcmp(*argv, "--size") == 0) {
client.size = strtol(*(++argv), &rem, 10);
--argc;
+ } else if (strcmp(*argv, "-q") == 0 ||
+ strcmp(*argv, "--qos") == 0) {
+ qos = *(++argv);
+ --argc;
} else if (strcmp(*argv, "-l") == 0 ||
strcmp(*argv, "--listen") == 0) {
serv = true;
@@ -201,6 +210,19 @@ int main(int argc,
if (duration > 0)
client.count = duration / client.interval;
+ if (qos != NULL) {
+ if (strcmp(qos, "best") == 0)
+ client.qs = qos_best_effort;
+ else if (strcmp(qos, "raw") == 0)
+ client.qs = qos_raw;
+ else if (strcmp(qos, "video") == 0)
+ client.qs = qos_video;
+ else if (strcmp(qos, "voice") == 0)
+ client.qs = qos_voice;
+ else
+ printf("Unknown QoS cube, defaulting to raw.\n");
+ }
+
if (serv) {
ret = server_main();
} else {