diff options
Diffstat (limited to 'src/tools/ocbr/ocbr.c')
-rw-r--r-- | src/tools/ocbr/ocbr.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/tools/ocbr/ocbr.c b/src/tools/ocbr/ocbr.c index e2a23c4a..775bcaac 100644 --- a/src/tools/ocbr/ocbr.c +++ b/src/tools/ocbr/ocbr.c @@ -1,10 +1,10 @@ /* - * Ouroboros - Copyright (C) 2016 - 2020 + * Ouroboros - Copyright (C) 2016 - 2024 * * CBR traffic generator * - * Dimitri Staessens <dimitri.staessens@ugent.be> - * Sander Vrijders <sander.vrijders@ugent.be> + * Dimitri Staessens <dimitri@ouroboros.rocks> + * Sander Vrijders <sander@ouroboros.rocks> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -76,6 +76,7 @@ static void usage(void) " -s, --size packet size (B, max %ld B)\n" " -r, --rate Rate (b/s)\n" " --sleep Sleep in between sending packets\n" + " --spin Spin CPU between sending packets\n" "\n\n" " --help Display this help text and exit\n", BUF_SIZE); @@ -87,7 +88,7 @@ int main(int argc, char ** argv) int size = 1000; /* 1000 byte packets */ long rate = 1000000; /* 1 Mb/s */ bool flood = false; - bool sleep = false; + bool sleep = true; int ret = 0; char * rem = NULL; char * s_apn = NULL; @@ -138,6 +139,8 @@ int main(int argc, char ** argv) flood = true; } else if (strcmp(*argv, "--sleep") == 0) { sleep = true; + } else if (strcmp(*argv, "--spin") == 0) { + sleep = false; } else { usage(); return 0; @@ -152,17 +155,22 @@ int main(int argc, char ** argv) if (s_apn == NULL) { printf("No server specified.\n"); usage(); - return 0; + return 1; } if (size > BUF_SIZE) { printf("Maximum size: %ld.\n", BUF_SIZE); - return 0; + return 1; } if (size < 0) { printf("Size overflow.\n"); - return 0; + return 1; + } + + if (rate <= 0) { + printf("Invalid rate.\n"); + return 1; } ret = client_main(s_apn, duration, size, rate, flood, sleep); |