Annotation of embedaddon/miniupnpd/testgetifstats.c, revision 1.1
1.1 ! misho 1: /* $Id: testgetifstats.c,v 1.4 2007/02/07 22:14:47 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 */
! 7:
! 8: #include <stdio.h>
! 9: #include <string.h>
! 10: #include <syslog.h>
! 11:
! 12: #include "getifstats.h"
! 13:
! 14: int
! 15: main(int argc, char **argv)
! 16: {
! 17: int r;
! 18: struct ifdata data;
! 19: if(argc<2)
! 20: {
! 21: fprintf(stderr, "usage : %s <ifname>\n", argv[0]);
! 22: return 1;
! 23: }
! 24: openlog("testgetifstats", LOG_CONS|LOG_PERROR, LOG_USER);
! 25: memset(&data, 0, sizeof(data));
! 26: r = getifstats(argv[1], &data);
! 27: printf("getifstats() returned %d\n", r);
! 28: printf("stats for interface %s :\n", argv[1]);
! 29: printf("bitrate = %lu\n", data.baudrate);
! 30: printf(" input packets : %9lu\t input bytes : %9lu\n",
! 31: data.ipackets, data.ibytes);
! 32: printf("output packets : %9lu\toutput bytes : %9lu\n",
! 33: data.opackets, data.obytes);
! 34: return 0;
! 35: }
! 36:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>