//
// $Id: ipfw-graph.h,v 1.6 2001/11/22 13:29:04 mavetju Exp $
//

#define BINDIR			"/usr/local/bin"

#define	MAXSTORED		1024
#define bool unsigned char

#define DECLARE_DRAWFUN(fun)	DRAWFUN fun
#define DECLARE_BYTESFUN(fun)	BYTESFUN fun
#define DECLARE_STATSFUN(fun)	STATSFUN fun
#define DECLARE_BGBYTESFUN(fun)	BYTESBGFUN fun
#define DECLARE_BGDRAWFUN(fun)	DRAWBGFUN fun
typedef void DRAWFUN(void);
typedef void BYTESFUN(void);
typedef void STATSFUN(void);
typedef void BGBYTESFUN(void);
typedef void BGDRAWFUN(void);

struct funtable {
    DRAWFUN *	drawing_fun;
    BYTESFUN *	bytes_fun;
    STATSFUN *	stats_fun;

    BGDRAWFUN *	bgdrawing_fun;
    BGBYTESFUN *bgbytes_fun;

    char *	description;
    char *	label;
    int		initialized;

    GtkWidget *	area;
    GdkPixmap *	pixmap;
};

extern gint		current_page;
extern GdkPixmap *	bytes_pixmap;
extern GtkWidget *	bytes_area;
extern GtkWidget *	text_area;
extern GdkGC *		gc_white;

typedef struct data_type	DATA_TYPE;
struct data_type {
    long	new;
    long	old;
    GdkGC *	gc;
    long	table[MAXSTORED];
    char *	rule;
    char *	number;

    bool	allow;
    bool	deny;
};

extern DATA_TYPE data_bytes;		// data for the bytes received
extern DATA_TYPE *data;;		// data for the ipfw rules
extern int	data_size;		// number of elements of data

extern int	xsize;			// xsize of the output
extern int	ysize_bytes,ysize_drawing;	// ysize of the bytes/piles output
extern long	maxyvalues[MAXSTORED];	// maxyvalues per column in the output
extern long	maxyvalue;		// biggest of the maxyvalues

// tables with pointers to the drawing functions
extern struct funtable drawtable[];

//
// ipfw-data.c
//
void	getdata(void);

//
// ipfw-gtk.c
//
void	init_gtk(int *argc,char **argv[]);
void	draw_background_bytes(void);
void	draw_background_drawing(void);
void	quit(void);
gint	expose_drawing_event(GtkWidget *,GdkEventExpose *);
gint	expose_bytes_event(GtkWidget *,GdkEventExpose *);
gint	configure_drawing_event(GtkWidget *,GdkEventConfigure *);
gint	configure_bytes_event(GtkWidget *,GdkEventConfigure *);
gint	button_press_event(GtkWidget *,GdkEventButton *);
GdkGC *	GetPen(GdkColor *);
GdkColor *NewColour(long,long,long);


//
// ipfw-core.c
//
void	draw_stats(void);
void	draw_tables(void);
void	draw_backgrounds(void);

//
// ipfw-log.c
//
void	log(const char *fmt,...);
void	debug(const char *fmt,...);

//
// ipfw-default.c
//
BGDRAWFUN	(bg_drawing);
BGBYTESFUN	(bg_bytes);
STATSFUN	(default_stats);

//
// ipfw-linear.c
//
DRAWFUN		(linear_drawing);
BYTESFUN	(linear_bytes);

//
// ipfw-denyonly.c
//
DRAWFUN		(denyonly_drawing);
BYTESFUN	(denyonly_bytes);

//
// ipfw-allowonly.c
//
DRAWFUN		(allowonly_drawing);
BYTESFUN	(allowonly_bytes);


syntax highlighted by Code2HTML, v. 0.9.1