xref: /netbsd/dist/pf/sbin/pflogd/pflogd.h (revision 6550d01e)
1 /*	$NetBSD: pflogd.h,v 1.4 2008/06/18 09:06:26 yamt Exp $	*/
2 /*	$OpenBSD: pflogd.h,v 1.3 2006/01/15 16:38:04 canacar Exp $ */
3 
4 /*
5  * Copyright (c) 2003 Can Erkin Acar
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifdef __OpenBSD__
21 #include <sys/limits.h>
22 #else
23 #include <limits.h>
24 #endif
25 #include <pcap.h>
26 
27 #define DEF_SNAPLEN 116		/* default plus allow for larger header of pflog */
28 #define PCAP_TO_MS 500		/* pcap read timeout (ms) */
29 #define PCAP_NUM_PKTS 1000	/* max number of packets to process at each loop */
30 #define PCAP_OPT_FIL 1		/* filter optimization */
31 #define FLUSH_DELAY 60		/* flush delay */
32 
33 #define PFLOGD_LOG_FILE		"/var/log/pflog"
34 #define PFLOGD_DEFAULT_IF	"pflog0"
35 
36 #define PFLOGD_MAXSNAPLEN	INT_MAX
37 #define PFLOGD_BUFSIZE		65536	/* buffer size for incoming packets */
38 
39 void  logmsg(int priority, const char *message, ...);
40 
41 /* Privilege separation */
42 int	priv_init(void);
43 int	priv_set_snaplen(int snaplen);
44 int	priv_open_log(void);
45 int	priv_move_log(void);
46 pcap_t *pcap_open_live_fd(int fd, int snaplen, char *ebuf);
47 
48 void set_pcap_filter(void);
49 /* File descriptor send/recv */
50 void send_fd(int, int);
51 int  receive_fd(int);
52 
53 extern int Debug;
54