1 /* $Id: testgetifstats.c,v 1.6 2012/06/22 16:11:58 nanard Exp $ */
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
12 #include "getifstats.h"
15 /* solaris 10 does not define LOG_PERROR */
20 main(int argc
, char **argv
)
26 fprintf(stderr
, "usage : %s <ifname>\n", argv
[0]);
29 openlog("testgetifstats", LOG_CONS
|LOG_PERROR
, LOG_USER
);
30 memset(&data
, 0, sizeof(data
));
31 r
= getifstats(argv
[1], &data
);
32 printf("getifstats() returned %d\n", r
);
33 printf("stats for interface %s :\n", argv
[1]);
34 printf("bitrate = %lu\n", data
.baudrate
);
35 printf(" input packets : %9lu\t input bytes : %9lu\n",
36 data
.ipackets
, data
.ibytes
);
37 printf("output packets : %9lu\toutput bytes : %9lu\n",
38 data
.opackets
, data
.obytes
);