FreeBSD/Linux Kernel Cross Reference
sys/netinet/ip_sync.h
1 /* $NetBSD: ip_sync.h,v 1.1.1.1 2004/03/28 08:56:52 martti Exp $ */
2
3 /*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * @(#)ip_fil.h 1.35 6/5/96
9 * Id: ip_sync.h,v 2.11 2004/01/03 13:34:59 darrenr Exp
10 */
11
12 typedef struct synchdr {
13 u_char sm_v; /* version: 4,6 */
14 u_char sm_p; /* protocol */
15 u_char sm_cmd; /* command */
16 u_char sm_table; /* NAT, STATE, etc */
17 u_int sm_num; /* table entry number */
18 int sm_rev; /* forward/reverse */
19 struct synclist *sm_sl; /* back pointer to parent */
20 } synchdr_t;
21
22
23 /*
24 * Commands
25 * No delete required as expirey will take care of that!
26 */
27 #define SMC_CREATE 0 /* pass ipstate_t after synchdr_t */
28 #define SMC_UPDATE 1
29 #define SMC_MAXCMD 1
30
31 /*
32 * Tables
33 */
34 #define SMC_NAT 0
35 #define SMC_STATE 1
36 #define SMC_MAXTBL 1
37
38
39 /*
40 * Only TCP requires "more" information than just a reference to the entry
41 * for which an update is being made.
42 */
43 typedef struct synctcp_update {
44 u_long stu_age;
45 tcpdata_t stu_data[2];
46 u_char stu_state[2];
47 } synctcp_update_t;
48
49
50 typedef struct synclist {
51 struct synclist *sl_next;
52 struct synclist **sl_pnext;
53 int sl_idx; /* update index */
54 struct synchdr sl_hdr;
55 union {
56 struct ipstate *slu_ips;
57 struct nat *slu_ipn;
58 void *slu_ptr;
59 } sl_un;
60 } synclist_t;
61
62 #define sl_ptr sl_un.slu_ptr
63 #define sl_ips sl_un.slu_ips
64 #define sl_ipn sl_un.slu_ipn
65 #define sl_v sl_hdr.sm_v
66 #define sl_p sl_hdr.sm_p
67 #define sl_cmd sl_hdr.sm_cmd
68 #define sl_rev sl_hdr.sm_rev
69 #define sl_table sl_hdr.sm_table
70 #define sl_num sl_hdr.sm_num
71
72 /*
73 * NOTE: SYNCLOG_SZ is defined *low*. It should be the next power of two
74 * up for whatever number of packets per second you expect to see. Be
75 * warned: this index's a table of large elements (upto 272 bytes in size
76 * each), and thus a size of 8192, for example, results in a 2MB table.
77 * The lesson here is not to use small machines for running fast firewalls
78 * (100BaseT) in sync, where you might have upwards of 10k pps.
79 */
80 #define SYNCLOG_SZ 256
81
82 typedef struct synclogent {
83 struct synchdr sle_hdr;
84 union {
85 struct ipstate sleu_ips;
86 struct nat sleu_ipn;
87 } sle_un;
88 } synclogent_t;
89
90 typedef struct syncupdent { /* 28 or 32 bytes */
91 struct synchdr sup_hdr;
92 struct synctcp_update sup_tcp;
93 } syncupdent_t;
94
95 extern synclogent_t synclog[SYNCLOG_SZ];
96
97
98 extern int fr_sync_ioctl __P((caddr_t, ioctlcmd_t, int));
99 extern synclist_t *ipfsync_new __P((int, fr_info_t *, void *));
100 extern void ipfsync_del __P((synclist_t *));
101 extern void ipfsync_update __P((int, fr_info_t *, synclist_t *));
102 extern int ipfsync_init __P((void));
103 extern int ipfsync_nat __P((synchdr_t *sp, struct uio *uio));
104 extern int ipfsync_state __P((synchdr_t *sp, struct uio *uio));
105 extern int ipfsync_read __P((struct uio *uio));
106 extern int ipfsync_write __P((struct uio *uio));
Cache object: e223f5916f54a29e5968cd8501511d7c
|