File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpd / testgetifstats.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:16:02 2012 UTC (12 years, 4 months ago) by misho
Branches: miniupnpd, elwix, MAIN
CVS tags: v1_6elwix, v1_5, HEAD
miniupnpd

    1: /* $Id: testgetifstats.c,v 1.1.1.1 2012/02/21 23:16:02 misho 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>