File: pload.h

package info (click to toggle)
pload 0.9.5-3.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 208 kB
  • ctags: 96
  • sloc: ansic: 897; makefile: 88; sh: 63
file content (73 lines) | stat: -rw-r--r-- 2,246 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
    This file is part of pload - a program to monitor ppp activity for X
    Copyright (C) 1999-2000  Matt Smith <mdsmith@engr.utk.edu>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

/* pload.h */
#ifndef PLOAD_H_INC
#define PLOAD_H_INC 1

#include <stdio.h>
#include <sys/time.h>	/* struct timeval */

struct if_dat
{
	int s;					/* socket or fd		*/
	char *device;				/* device to monitor 	*/
#ifdef STREAMS
	int dev_n;				/* number of the device */
#endif
#ifdef LINUXPROC
	FILE *file;				/* /proc/net/dev	*/
#endif	
	unsigned long in_bytes;			/* total bytes in 	*/
	unsigned long in_bytes_old;		/* last total bytes in	*/
	unsigned long out_bytes;		/* total bytes out 	*/
	unsigned long out_bytes_old;		/* last total byts out	*/
	struct timeval prev_time;		/* last time 		*/
	struct timeval curr_time;		/* time now		*/
	int history_size;			/* # pts to average over*/
	double *in_history;			/* in history array 	*/
	double *out_history;			/* out history array 	*/
	double in_rate;				/* in rate, bytes/s 	*/
	double out_rate;			/* out rate, bytes/s 	*/
	double in_max;				/* maximum in rate b/s	*/
	double out_max;				/* maximum out rate b/s	*/
	void (*getstats)(struct if_dat*);	/* function to get stats*/
};

typedef struct if_dat if_data;

/* function prototypes */
void ifd_initialize(if_data*, char*, int, int);
void ifd_stop(if_data*);
void getsocket(if_data*);
void get_stat(if_data*);
void ioctl_stat(if_data*);
void die(char*);

#ifdef STREAMS
int strioctl(int, int, void*, int, int);
#endif

#ifdef LINUXPROC
void proc_stat(if_data*);
#endif


#endif /* PLOAD_H_INC */