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