summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-10-22 11:33:20 +0000
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-10-22 11:33:20 +0000
commit727efbe0c5e61862a870c71a2857b28eece3d369 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/tools
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
parent3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff)
downloadouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz
ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/cbr/cbr.c2
-rw-r--r--src/tools/cbr/cbr_client.c15
-rw-r--r--src/tools/cbr/cbr_server.c15
-rw-r--r--src/tools/echo/echo.c2
-rw-r--r--src/tools/echo/echo_client.c2
-rw-r--r--src/tools/echo/echo_server.c4
-rw-r--r--src/tools/irm/irm.c5
-rw-r--r--src/tools/irm/irm_bind.c5
-rw-r--r--src/tools/irm/irm_bind_ap.c2
-rw-r--r--src/tools/irm/irm_bind_api.c2
-rw-r--r--src/tools/irm/irm_bind_ipcp.c2
-rw-r--r--src/tools/irm/irm_ipcp.c5
-rw-r--r--src/tools/irm/irm_ipcp_bootstrap.c2
-rw-r--r--src/tools/irm/irm_ipcp_create.c2
-rw-r--r--src/tools/irm/irm_ipcp_destroy.c2
-rw-r--r--src/tools/irm/irm_ipcp_enroll.c2
-rw-r--r--src/tools/irm/irm_register.c2
-rw-r--r--src/tools/irm/irm_unbind.c5
-rw-r--r--src/tools/irm/irm_unbind_ap.c2
-rw-r--r--src/tools/irm/irm_unbind_api.c2
-rw-r--r--src/tools/irm/irm_unbind_ipcp.c2
-rw-r--r--src/tools/irm/irm_unregister.c2
-rw-r--r--src/tools/irm/irm_utils.c2
-rw-r--r--src/tools/oping/oping.c10
-rw-r--r--src/tools/oping/oping_client.c15
-rw-r--r--src/tools/oping/oping_server.c13
26 files changed, 79 insertions, 45 deletions
diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c
index 27c51586..efcb2847 100644
--- a/src/tools/cbr/cbr.c
+++ b/src/tools/cbr/cbr.c
@@ -64,7 +64,7 @@ static void usage(void)
int main(int argc, char ** argv)
{
- int duration = 60; /* One minute test */
+ int duration = 60; /* One minute test */
int size = 1000; /* 1000 byte SDUs */
long rate = 1000000; /* 1 Mb/s */
bool flood = false;
diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c
index af766599..b2cf7d7f 100644
--- a/src/tools/cbr/cbr_client.c
+++ b/src/tools/cbr/cbr_client.c
@@ -46,8 +46,8 @@ int client_main(char * server,
int result = 0;
bool stop = false;
char buf[size];
- long seqnr = 0;
- unsigned long gap = size * 8.0 * (BILLION / (double) rate);
+ int seqnr = 0;
+ long gap = size * 8.0 * (BILLION / (double) rate);
struct timespec start;
struct timespec end;
@@ -55,7 +55,7 @@ int client_main(char * server,
int ms;
printf("Client started, duration %d, rate %lu b/s, size %d B.\n",
- duration, rate, size);
+ duration, rate, size);
fd = flow_alloc(server, NULL, NULL);
if (fd < 0) {
@@ -85,18 +85,17 @@ int client_main(char * server,
if (sleep)
nanosleep(&intv, NULL);
else
- busy_wait_until(&end);
+ busy_wait_until(&end);
++seqnr;
- if (ts_diff_us(&start, &end) / MILLION
- >= (long) duration)
+ if (ts_diff_us(&start, &end) / MILLION >= duration)
stop = true;
}
} else { /* flood */
while (!stop) {
clock_gettime(CLOCK_REALTIME, &end);
- if (flow_write(fd, buf, size) == -1) {
+ if (flow_write(fd, buf, (size_t) size) == -1) {
stop = true;
continue;
}
@@ -115,7 +114,7 @@ int client_main(char * server,
ms = ts_diff_ms(&start, &end);
printf("sent statistics: "
- "%9ld SDUs, %12ld bytes in %9d ms, %4.4f Mb/s\n",
+ "%9d SDUs, %12d bytes in %9d ms, %4.4f Mb/s\n",
seqnr, seqnr * size, ms, (seqnr * size * 8.0)/(ms * 1000));
flow_dealloc(fd);
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index c5664d8b..f1c342d1 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -48,6 +48,9 @@ pthread_cond_t fds_signal;
void shutdown_server(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -60,7 +63,7 @@ void shutdown_server(int signo, siginfo_t * info, void * c)
void handle_flow(int fd)
{
- ssize_t count = 0;
+ int count = 0;
char buf[BUF_SIZE];
struct timespec now;
@@ -109,9 +112,9 @@ void handle_flow(int fd)
sdus - sdus_intv,
bytes_read - bytes_read_intv,
us / 1000,
- ((sdus - sdus_intv) / (float) us) * MILLION,
+ ((sdus - sdus_intv) / (double) us) * MILLION,
8 * (bytes_read - bytes_read_intv)
- / (float)(us));
+ / (double)(us));
iv_start = iv_end;
sdus_intv = sdus;
bytes_read_intv = bytes_read;
@@ -124,6 +127,8 @@ void * worker(void * o)
{
int cli_fd;
+ (void) o;
+
while (true) {
pthread_mutex_lock(&fds_lock);
pthread_cleanup_push((void(*)(void *)) pthread_mutex_unlock,
@@ -151,6 +156,8 @@ void * listener(void * o)
int client_fd = 0;
int response = 0;
+ (void) o;
+
printf("Server started, interval is %ld s, timeout is %ld s.\n",
server_settings.interval, server_settings.timeout);
@@ -190,7 +197,7 @@ void * listener(void * o)
return 0;
}
-int server_main()
+int server_main(void)
{
struct sigaction sig_act;
int i;
diff --git a/src/tools/echo/echo.c b/src/tools/echo/echo.c
index 28ae4c1a..82d280f9 100644
--- a/src/tools/echo/echo.c
+++ b/src/tools/echo/echo.c
@@ -30,7 +30,7 @@
#include "echo_client.c"
#include "echo_server.c"
-static void usage()
+static void usage(void)
{
printf("Usage: echo-app [OPTION]...\n"
"Sends an echo between a server and a client\n\n"
diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c
index f006273c..3507364a 100644
--- a/src/tools/echo/echo_client.c
+++ b/src/tools/echo/echo_client.c
@@ -23,7 +23,7 @@
#include <ouroboros/dev.h>
#include <stdlib.h>
-int client_main()
+int client_main(void)
{
int fd = 0;
int result = 0;
diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c
index e6ab9cfd..070f0ce3 100644
--- a/src/tools/echo/echo_server.c
+++ b/src/tools/echo/echo_server.c
@@ -29,11 +29,13 @@
void shutdown_server(int signo)
{
+ (void) signo;
+
ap_fini();
exit(EXIT_SUCCESS);
}
-int server_main()
+int server_main(void)
{
int client_fd = 0;
char buf[BUF_SIZE];
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c
index a674c7ba..be758098 100644
--- a/src/tools/irm/irm.c
+++ b/src/tools/irm/irm.c
@@ -27,7 +27,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm [OPERATION]\n\n"
"where OPERATION = {ipcp bind unbind\n"
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c
index 9b37e800..bb441573 100644
--- a/src/tools/irm/irm_bind.c
+++ b/src/tools/irm/irm_bind.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind [OPERATION]\n"
"where OPERATION = {ap api ipcp help}\n");
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c
index 189b197e..b558f072 100644
--- a/src/tools/irm/irm_bind_ap.c
+++ b/src/tools/irm/irm_bind_ap.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind ap <ap>\n"
" name <name>\n"
diff --git a/src/tools/irm/irm_bind_api.c b/src/tools/irm/irm_bind_api.c
index abc21b3d..54ecf51d 100644
--- a/src/tools/irm/irm_bind_api.c
+++ b/src/tools/irm/irm_bind_api.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind api <pid> name <name>\n");
}
diff --git a/src/tools/irm/irm_bind_ipcp.c b/src/tools/irm/irm_bind_ipcp.c
index 2d517994..f30c6ef8 100644
--- a/src/tools/irm/irm_bind_ipcp.c
+++ b/src/tools/irm/irm_bind_ipcp.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm bind ipcp <name> name <name>\n");
}
diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c
index 1b523feb..795281bb 100644
--- a/src/tools/irm/irm_ipcp.c
+++ b/src/tools/irm/irm_ipcp.c
@@ -25,7 +25,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp [OPERATION]\n\n"
"where OPERATION = {create destroy\n"
@@ -34,6 +34,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c
index ba9b7e2e..cc1bf6f9 100644
--- a/src/tools/irm/irm_ipcp_bootstrap.c
+++ b/src/tools/irm/irm_ipcp_bootstrap.c
@@ -46,7 +46,7 @@
#define DEFAULT_MAX_PDU_SIZE 9000
#define DEFAULT_DDNS 0
-static void usage()
+static void usage(void)
{
/* FIXME: Add dif_config stuff */
printf("Usage: irm ipcp bootstrap\n"
diff --git a/src/tools/irm/irm_ipcp_create.c b/src/tools/irm/irm_ipcp_create.c
index b43a544e..e9921112 100644
--- a/src/tools/irm/irm_ipcp_create.c
+++ b/src/tools/irm/irm_ipcp_create.c
@@ -33,7 +33,7 @@
#define SHIM_ETH_LLC "shim-eth-llc"
#define LOCAL "local"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp create\n"
" name <ipcp name>\n"
diff --git a/src/tools/irm/irm_ipcp_destroy.c b/src/tools/irm/irm_ipcp_destroy.c
index 9768b5e1..d3bc0cf3 100644
--- a/src/tools/irm/irm_ipcp_destroy.c
+++ b/src/tools/irm/irm_ipcp_destroy.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp destroy\n"
" name <ipcp name>\n");
diff --git a/src/tools/irm/irm_ipcp_enroll.c b/src/tools/irm/irm_ipcp_enroll.c
index 32d8be54..b5517bcd 100644
--- a/src/tools/irm/irm_ipcp_enroll.c
+++ b/src/tools/irm/irm_ipcp_enroll.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm ipcp enroll\n"
" name <ipcp name>\n"
diff --git a/src/tools/irm/irm_register.c b/src/tools/irm/irm_register.c
index 62470d1d..22de402f 100644
--- a/src/tools/irm/irm_register.c
+++ b/src/tools/irm/irm_register.c
@@ -30,7 +30,7 @@
#define MAX_DIFS 128
-static void usage()
+static void usage(void)
{
printf("Usage: irm register\n"
" name <name>\n"
diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c
index 0290e678..5d167e1c 100644
--- a/src/tools/irm/irm_unbind.c
+++ b/src/tools/irm/irm_unbind.c
@@ -28,7 +28,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind [OPERATION]\n"
"where OPERATION = {ap api ipcp help}\n");
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_unbind_ap.c b/src/tools/irm/irm_unbind_ap.c
index bdfcbaad..8ad3d670 100644
--- a/src/tools/irm/irm_unbind_ap.c
+++ b/src/tools/irm/irm_unbind_ap.c
@@ -29,7 +29,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind ap <ap>\n"
" [name <name>, omit: remove all AP info]\n");
diff --git a/src/tools/irm/irm_unbind_api.c b/src/tools/irm/irm_unbind_api.c
index b69a4579..d332f438 100644
--- a/src/tools/irm/irm_unbind_api.c
+++ b/src/tools/irm/irm_unbind_api.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind api <pid>\n"
" [name <name>, omit: remove all AP-I info]\n");
diff --git a/src/tools/irm/irm_unbind_ipcp.c b/src/tools/irm/irm_unbind_ipcp.c
index db310e05..33d7a818 100644
--- a/src/tools/irm/irm_unbind_ipcp.c
+++ b/src/tools/irm/irm_unbind_ipcp.c
@@ -30,7 +30,7 @@
#include "irm_ops.h"
#include "irm_utils.h"
-static void usage()
+static void usage(void)
{
printf("Usage: irm unbind ipcp <name>\n"
" [name <name>, omit: remove all information.\n");
diff --git a/src/tools/irm/irm_unregister.c b/src/tools/irm/irm_unregister.c
index edcd42bb..12c1eb22 100644
--- a/src/tools/irm/irm_unregister.c
+++ b/src/tools/irm/irm_unregister.c
@@ -31,7 +31,7 @@
#define MAX_DIFS 128
-static void usage()
+static void usage(void)
{
printf("Usage: irm unregister\n"
" name <name>\n"
diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c
index 41a1e811..151d1869 100644
--- a/src/tools/irm/irm_utils.c
+++ b/src/tools/irm/irm_utils.c
@@ -28,7 +28,7 @@
int matches(const char * cmd, const char * pattern)
{
- int len = strlen(cmd);
+ size_t len = strlen(cmd);
if (len > strlen(pattern))
return -1;
diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c
index 0ca40326..b476b33a 100644
--- a/src/tools/oping/oping.c
+++ b/src/tools/oping/oping.c
@@ -48,10 +48,10 @@ struct c {
/* stats */
int sent;
int rcvd;
- float rtt_min;
- float rtt_max;
- float rtt_avg;
- float rtt_m2;
+ double rtt_min;
+ double rtt_max;
+ double rtt_avg;
+ double rtt_m2;
flow_set_t * flows;
@@ -82,7 +82,7 @@ struct oping_msg {
#include "oping_client.c"
#include "oping_server.c"
-static void usage()
+static void usage(void)
{
printf("Usage: oping [OPTION]...\n"
"Checks liveness between a client and a server\n"
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 40f75785..9f49a1df 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -39,6 +39,9 @@
void shutdown_client(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -59,12 +62,14 @@ void * reader(void * o)
struct oping_msg * msg = (struct oping_msg *) buf;
int fd = 0;
int msg_len = 0;
- float ms = 0;
- float d = 0;
+ double ms = 0;
+ double d = 0;
fqueue_t * fq = fqueue_create();
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
/* FIXME: use flow timeout option once we have it */
while (client.rcvd != client.count
&& flow_event_wait(client.flows, fq, &timeout) != -ETIMEDOUT) {
@@ -78,7 +83,7 @@ void * reader(void * o)
continue;
}
- if (ntohl(msg->id) >= client.count) {
+ if (ntohl(msg->id) >= (ssize_t) client.count) {
printf("Invalid id.\n");
continue;
}
@@ -89,7 +94,7 @@ void * reader(void * o)
pthread_mutex_lock(&client.lock);
ms = ts_diff_us(&client.times[ntohl(msg->id)], &now)
- /1000.0;
+ / 1000.0;
pthread_mutex_unlock(&client.lock);
printf("%d bytes from %s: seq=%d time=%.3f ms\n",
@@ -159,7 +164,7 @@ void * writer(void * o)
return (void *) 0;
}
-int client_main()
+int client_main(void)
{
struct sigaction sig_act;
diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c
index 8a5a3512..193b76d1 100644
--- a/src/tools/oping/oping_server.c
+++ b/src/tools/oping/oping_server.c
@@ -31,6 +31,9 @@
void shutdown_server(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -47,6 +50,8 @@ void * cleaner_thread(void * o)
struct timespec now = {0, 0};
int deadline_ms = 10000;
+ (void) o;
+
while (true) {
clock_gettime(CLOCK_REALTIME, &now);
pthread_mutex_lock(&server.lock);
@@ -74,6 +79,8 @@ void * server_thread(void *o)
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
while (true) {
int ret = flow_event_wait(server.flows, fq, &timeout);
if (ret == -ETIMEDOUT)
@@ -100,7 +107,7 @@ void * server_thread(void *o)
server.times[fd] = now;
pthread_mutex_unlock(&server.lock);
- msg->type = htonl((uint32_t) ECHO_REPLY);
+ msg->type = htonl(ECHO_REPLY);
if (flow_write(fd, buf, msg_len) < 0) {
printf("Error writing to flow (fd %d).\n", fd);
@@ -117,6 +124,8 @@ void * accept_thread(void * o)
int fd = 0;
struct timespec now = {0, 0};
+ (void) o;
+
printf("Ouroboros ping server started.\n");
while (true) {
@@ -147,7 +156,7 @@ void * accept_thread(void * o)
return (void *) 0;
}
-int server_main()
+int server_main(void)
{
struct sigaction sig_act;