summaryrefslogtreecommitdiff
path: root/proto/firewall/firewall.h
blob: 7b16301a7986dcaffd84417e01a1393263ec97bd (plain)
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
/*
 *	BIRD -- Firewall Protocol Configuration
 *
 *	(c) 2011 Alexander V. Chernikov <<A HREF="http://trubka.network.cz/mailman/listinfo/bird-users">melifaro at FreeBSD.org</A>>
 *
 *	Can be freely distributed and used under the terms of the GNU GPL.
 */

#ifndef _BIRD_FIREWALL_H_
#define _BIRD_FIREWALL_H_

#define FWTYPE_IPFW		0
#define FWTYPE_PF		1
#define FWTYPE_IPSET		2

#define FWTYPE_MAX		3

#define EA_FIREWALL_VALUE	EA_CODE(EAP_FIREWALL, 0)

struct firewall_config {
  struct proto_config c;
  int fwtype;				/* Firewall type */
  char *fwtable;			/* Firewall table to write to */
  int flush_start;			/* Do table flush on startup? */
  int flush_shutdown;			/* Do table flush on shutdown? */
};

struct firewall_control {
  int fwtype;				/* Firewall type */
  char *description;			/* Firewall description */
  void *(*fw_init)(struct proto *, char *);	/* Init firewall instance */
  void (*fw_shutdown)(void *);		/* Shutdown firewall instance */
  int (*fw_flush)(void *);		/* Flush firewall table */
  int (*fw_add)(void *, net *, char *);	/* Add record to table */
  int (*fw_del)(void *, net *);		/* Remove record from table */
  int (*fw_replace)(void *, net *, char *);	/* Replace record. Optional */
};

struct firewall_control * firewalls[FWTYPE_MAX];

struct firewall_proto {
  struct proto p;
  int fwtype;				/* Firewall type */
  struct firewall_control *fw;		/* Pointer to configured protocol type */
  void *fwdata;				/* Firewall instance private data */
};

extern struct protocol proto_firewall;

extern struct firewall_control fw_ipfw, fw_pf, fw_ipset;

#endif