Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / ip_scan.h
blob70f547efd1d1a18e1321ba72b3e22e2182193325
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 1993-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * @(#)ip_fil.h 1.35 6/5/96
9 * Id: ip_scan.h,v 2.9.2.2 2006/07/14 06:12:19 darrenr Exp
12 #ifndef __IP_SCAN_H__
13 #define __IP_SCAN_H__ 1
15 #ifdef sun
16 # include <sys/ioccom.h>
17 #endif
19 #define IPSCAN_NAME "/dev/ipscan"
20 #define IPL_SCAN IPSCAN_NAME
21 #define ISC_TLEN 16
24 struct fr_info;
25 struct frentry;
26 struct ip;
27 struct ipstate;
30 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
31 # define SIOCADSCA _IOWR('r', 60, struct ipscan *)
32 # define SIOCRMSCA _IOWR('r', 61, struct ipscan *)
33 # define SIOCGSCST _IOWR('r', 62, struct ipscan *)
34 #else
35 # define SIOCADSCA _IOWR(r, 60, struct ipscan *)
36 # define SIOCRMSCA _IOWR(r, 61, struct ipscan *)
37 # define SIOCGSCST _IOWR(r, 62, struct ipscan *)
38 #endif
40 struct action {
41 int act_val; /* what to do */
42 struct in_addr act_ip; /* redirect IP# */
43 u_short act_port; /* redirect port number */
44 int act_else; /* what to do */
45 struct in_addr act_eip; /* redirect IP# */
46 u_short act_eport; /* redirect port number */
50 typedef struct sinfo {
51 char s_txt[ISC_TLEN]; /* text to match */
52 char s_msk[ISC_TLEN]; /* mask of the above to check */
53 int s_len; /* length of server text */
54 } sinfo_t;
57 typedef struct ipscan {
58 struct ipscan *ipsc_next;
59 struct ipscan **ipsc_pnext;
60 char ipsc_tag[ISC_TLEN]; /* table entry protocol tag */
61 sinfo_t ipsc_si[2]; /* client/server side information */
62 int ipsc_hits; /* times this has been matched */
63 int ipsc_active; /* # of active matches */
64 int ipsc_fref; /* # of references from filter rules */
65 int ipsc_sref; /* # of references from state entries */
66 struct action ipsc_act;
67 } ipscan_t;
70 #define ipsc_cl ipsc_si[0]
71 #define ipsc_sl ipsc_si[1]
72 #define ipsc_ctxt ipsc_cl.s_txt
73 #define ipsc_cmsk ipsc_cl.s_msk
74 #define ipsc_clen ipsc_cl.s_len
75 #define ipsc_stxt ipsc_sl.s_txt
76 #define ipsc_smsk ipsc_sl.s_msk
77 #define ipsc_slen ipsc_sl.s_len
78 #define ipsc_action ipsc_act.act_val
79 #define ipsc_ip ipsc_act.act_ip
80 #define ipsc_port ipsc_act.act_port
81 #define ipsc_else ipsc_act.act_else
82 #define ipsc_eip ipsc_act.act_eip
83 #define ipsc_eport ipsc_act.act_eport
85 #define ISC_A_NONE 0
86 #define ISC_A_TRACK 1
87 #define ISC_A_CLOSE 2
88 #define ISC_A_REDIRECT 3
91 typedef struct ipscanstat {
92 struct ipscan *iscs_list;
93 u_long iscs_acted;
94 u_long iscs_else;
95 int iscs_entries;
96 } ipscanstat_t;
99 extern int fr_scan_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));
100 extern int ipsc_init __P((void));
101 extern int ipsc_attachis __P((struct ipstate *));
102 extern int ipsc_attachfr __P((struct frentry *));
103 extern int ipsc_detachis __P((struct ipstate *));
104 extern int ipsc_detachfr __P((struct frentry *));
105 extern int ipsc_packet __P((struct fr_info *, struct ipstate *));
106 extern void fr_scanunload __P((void));
108 #endif /* __IP_SCAN_H__ */