File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpd / testgetifstats.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 00:32:35 2013 UTC (11 years, 5 months ago) by misho
Branches: miniupnpd, elwix, MAIN
CVS tags: v1_8p0, v1_8, HEAD
1.8

    1: /* $Id: testgetifstats.c,v 1.1.1.2 2013/07/22 00:32:35 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: #if defined(__sun)
   15: /* solaris 10 does not define LOG_PERROR */
   16: #define LOG_PERROR 0
   17: #endif
   18: 
   19: int
   20: main(int argc, char **argv)
   21: {
   22: 	int r;
   23: 	struct ifdata data;
   24: 	if(argc<2)
   25: 	{
   26: 		fprintf(stderr, "usage : %s <ifname>\n", argv[0]);
   27: 		return 1;
   28: 	}
   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;
   40: }
   41: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>