BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src / router / miniupnpd / testgetifstats.c
blobc4208ca105a37f8f5a25739c529ea9963f7c949e
1 /* $Id: testgetifstats.c,v 1.6 2012/06/22 16:11:58 nanard Exp $ */
2 /* MiniUPnP project
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 */
8 #include <stdio.h>
9 #include <string.h>
10 #include <syslog.h>
12 #include "getifstats.h"
14 #if defined(__sun)
15 /* solaris 10 does not define LOG_PERROR */
16 #define LOG_PERROR 0
17 #endif
19 int
20 main(int argc, char **argv)
22 int r;
23 struct ifdata data;
24 if(argc<2)
26 fprintf(stderr, "usage : %s <ifname>\n", argv[0]);
27 return 1;
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);
39 return 0;