#ifndef _GATEKEEPER_D
#define _GATEKEEPER_D

#define DEFAULT (-1)
#define ALLOW	0
#define DENY	1

#define IN	0
#define OUT	1


#define FIREWALL_CF	"/etc/gatekeeper.cf"

typedef union _address {
    unsigned long ip;		/* IPV4 address, as either a long or */
    unsigned char octet[4];	/* 4 octets */
} ADDRESS;

typedef struct _duple {
    unsigned long ip, netmask;	/* IP, modified by netmask: 0 is wildcard */
    unsigned short port;	/* port: 0 is wildcard */
} connection;

typedef struct _pentry {
    connection from, to;	/* where we're coming from, where we're going */
    int todo;			/* ALLOW or DENY */
} PENTRY;


typedef struct _plist {
    PENTRY *list;
    int   nrlist;
} *PLIST;


typedef struct _perms {
    PLIST traf[2];
#define p_from	traf[OUT]
#define p_to	traf[IN]
} PERMS;

extern int debug;
extern char *config_file;
extern PERMS perms;
extern int allow(connection*, connection*, int);
extern int readcfg();
extern void init_message();
extern void end_message();
extern void message(int, int, connection *, connection *);

#endif/*_GATEKEEPER_D*/
