Blame view

pdw committed
1 2 3 4 5 6 7 8
/*
 * iftop.h:
 *
 */

#ifndef __IFTOP_H_ /* include guard */
#define __IFTOP_H_

chris committed
9 10
#include "config.h"

11
/* 40 / 2  */
pdw committed
12
#define HISTORY_LENGTH  20
pdw committed
13
#define RESOLUTION 2
pdw committed
14
#define DUMP_RESOLUTION 300
pdw committed
15

16 17 18 19 20 21 22 23 24 25
/* At least OpenBSD and NexentaCore do not
 * define s6_addr32 for user land settings.
 */
#if !defined s6_addr32 && defined __sun__
#	define s6_addr32 _S6_un._S6_u32
#elif !defined s6_addr32 && \
		( defined __OpenBSD__ || defined __FreeBSD__ )
#	define s6_addr32 __u6_addr.__u6_addr32
#endif	/* !defined s6_addr32 */

pdw committed
26 27 28
typedef struct {
    long recv[HISTORY_LENGTH];
    long sent[HISTORY_LENGTH];
29 30
    double long total_sent;
    double long total_recv;
pdw committed
31 32 33
    int last_write;
} history_type;

pdw committed
34
void tick(int print);
pdw committed
35

chris committed
36 37 38 39 40 41
void *xmalloc(size_t n);
void *xcalloc(size_t n, size_t m);
void *xrealloc(void *w, size_t n);
char *xstrdup(const char *s);
void xfree(void *v);

chris committed
42 43 44
/* options.c */
void options_read(int argc, char **argv);

45 46 47 48 49 50 51 52 53 54 55 56
struct pfloghdr {
      unsigned char		length;
      unsigned char		af;
      unsigned char		action;
      unsigned char		reason;
      char				ifname[16];
      char				ruleset[16];
      unsigned int		rulenr;
      unsigned int		subrulenr;
      unsigned char		dir;
      unsigned char		pad[3];
};
57

pdw committed
58
#endif /* __IFTOP_H_ */