wmcalc: Move changelog from README to new ChangeLog file.
[dockapps.git] / wmnet / wmnet.h
blob97a4b482f0fd90adc65243f00bfdad18b5ae8a08
1 /* wmnet -- X IP accounting monitor
2 * Copyright 1998, 2000 Jesse B. Off, Katharine Osborne
3 * <kaos@digitalkaos.net>
5 * $Id: wmnet.h,v 1.2 1998/10/06 00:06:12 joff Exp $
7 * This software is released under the GNU Public License agreement.
8 * No warranties, whatever.... you know the usuals.... this is free
9 * software. if you use it, great... if you wanna make a change to it,
10 * great, but please send me the diff. If you put it on a distributed
11 * CD, great... I'd appreciate a copy of the CD though ;).
16 #define TOPBOX_X 4
17 #define TOPBOX_Y 4
18 #define TOPBOX_WIDTH 56
19 #define TOPBOX_HEIGHT 11
21 /* Graphing area extents */
22 #define GRAPHBOX_X 4
23 #define GRAPHBOX_Y 15
24 #define GRAPHBOX_WIDTH 56
25 #define GRAPHBOX_HEIGHT graphbox_height
27 #define GRAPHBOX_X_RIGHT (GRAPHBOX_X + GRAPHBOX_WIDTH - 1)
28 #define GRAPHBOX_X_LEFT (GRAPHBOX_X)
29 #define GRAPHBOX_Y_TOP (GRAPHBOX_Y)
30 #define GRAPHBOX_Y_BOTTOM (GRAPHBOX_Y + GRAPHBOX_HEIGHT - 1)
32 /* Graphing area minus the borders */
33 #define GRAPH_X (GRAPHBOX_X + 1)
34 #define GRAPH_Y (GRAPHBOX_Y)
35 #define GRAPH_WIDTH (GRAPHBOX_WIDTH - 2)
36 #define GRAPH_HEIGHT (GRAPHBOX_HEIGHT - 1)
38 #define GRAPH_X_LEFT (GRAPH_X)
39 #define GRAPH_X_RIGHT (GRAPH_X + GRAPH_WIDTH - 1)
40 #define GRAPH_Y_UPPER (GRAPH_Y)
41 #define GRAPH_Y_BOTTOM (GRAPH_Y + GRAPH_HEIGHT - 1)
44 /* Label area box */
45 #define LABEL_X (GRAPHBOX_X_LEFT)
46 #define LABEL_Y (GRAPHBOX_Y_BOTTOM + 1)
47 #define LABEL_WIDTH (GRAPHBOX_WIDTH)
48 #define LABEL_HEIGHT 11
50 #define LABEL_X_LEFT (LABEL_X_LEFT)
51 #define LABEL_X_RIGHT (LABEL_X_LEFT + LABEL_WIDTH - 1)
52 #define LABEL_Y_TOP (LABEL_Y)
53 #define LABEL_Y_BOTTOM (LABEL_Y + LABEL_HEIGHT - 1)
56 #define LOW_INTENSITY 0
57 #define NORMAL_INTENSITY 1
58 #define HIGH_INTENSITY 2
64 /* X Stuff */
65 Display *dpy;
66 Window root_window, main_window, icon_window, *visible_window;
67 Font thefont;
68 Pixmap arrow;
69 Atom delete_atom;
70 int screen, specified_state = -1;
71 GC graphics_context;
72 unsigned long tx_pixel[3], rx_pixel[3], labelfg_pixel, labelbg_pixel, black_pixel, white_pixel, darkgrey_pixel, grey_pixel;
73 typedef int (*parser_func)(void);
75 /* I know statically declared buffers are against GNU coding standards, so sue me */
76 char buffer[256], *click_command = NULL, *label = NULL;
77 struct timeval timenow, timelast;
78 unsigned long long int totalbytes_in, totalbytes_out, lastbytes_in, lastbytes_out;
79 unsigned long long int totalpackets_in, totalpackets_out, lastpackets_in, lastpackets_out;
80 unsigned int diffbytes_in, diffbytes_out;
81 unsigned int delayTime = 100000, displayDelay = 55000, maxRate = 120000;
82 unsigned int out_rule = 2, in_rule = 1, graphbox_height = 44; /* number of rule in /proc/net/ip_acct to use */
83 char *in_rule_string = NULL, *out_rule_string = NULL, *device=NULL;
84 Bool current_tx = False, current_rx = False, rx, tx, logscale = False;
85 parser_func stat_gather;
89 void exit_func(void);
90 void got_signal(int x);
91 void setup_wmnet(int argc, char **argv);
92 void setupX(void);
93 void createWin(Window *win);
94 int updateStats(void);
95 void redraw(XExposeEvent *ee);
96 void tock(void);
97 int updateSpeedometer(int rxRate, int txRate);
98 void drawColoredLine(int y1, int y2, unsigned long *shadecolor);
99 void shadesOf(XColor *shade, unsigned long *returnarray);
101 extern parser_func setup_driver(char *parser);
102 extern char * available_drivers(void);