xref: /dflybsd-src/usr.sbin/pflogd/pflogd.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*	$OpenBSD: pflogd.h,v 1.3 2006/01/15 16:38:04 canacar Exp $ */
286d7f5d3SJohn Marino 
386d7f5d3SJohn Marino /*
486d7f5d3SJohn Marino  * Copyright (c) 2003 Can Erkin Acar
586d7f5d3SJohn Marino  *
686d7f5d3SJohn Marino  * Permission to use, copy, modify, and distribute this software for any
786d7f5d3SJohn Marino  * purpose with or without fee is hereby granted, provided that the above
886d7f5d3SJohn Marino  * copyright notice and this permission notice appear in all copies.
986d7f5d3SJohn Marino  *
1086d7f5d3SJohn Marino  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1186d7f5d3SJohn Marino  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1286d7f5d3SJohn Marino  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1386d7f5d3SJohn Marino  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1486d7f5d3SJohn Marino  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1586d7f5d3SJohn Marino  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1686d7f5d3SJohn Marino  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1786d7f5d3SJohn Marino  */
1886d7f5d3SJohn Marino 
1986d7f5d3SJohn Marino #include <limits.h>
2086d7f5d3SJohn Marino #include <pcap.h>
2186d7f5d3SJohn Marino 
2286d7f5d3SJohn Marino #define DEF_SNAPLEN 116		/* default plus allow for larger header of pflog */
2386d7f5d3SJohn Marino #define PCAP_TO_MS 500		/* pcap read timeout (ms) */
2486d7f5d3SJohn Marino #define PCAP_NUM_PKTS 1000	/* max number of packets to process at each loop */
2586d7f5d3SJohn Marino #define PCAP_OPT_FIL 1		/* filter optimization */
2686d7f5d3SJohn Marino #define FLUSH_DELAY 60		/* flush delay */
2786d7f5d3SJohn Marino 
2886d7f5d3SJohn Marino #define PFLOGD_LOG_FILE		"/var/log/pflog"
2986d7f5d3SJohn Marino #define PFLOGD_DEFAULT_IF	"pflog0"
3086d7f5d3SJohn Marino 
3186d7f5d3SJohn Marino #define PFLOGD_MAXSNAPLEN	INT_MAX
3286d7f5d3SJohn Marino #define PFLOGD_BUFSIZE		65536	/* buffer size for incoming packets */
3386d7f5d3SJohn Marino 
3486d7f5d3SJohn Marino void  logmsg(int priority, const char *message, ...) __printflike(2, 3);
3586d7f5d3SJohn Marino 
3686d7f5d3SJohn Marino /* Privilege separation */
3786d7f5d3SJohn Marino int	priv_init(void);
3886d7f5d3SJohn Marino int	priv_set_snaplen(int snaplen);
3986d7f5d3SJohn Marino int	priv_open_log(void);
4086d7f5d3SJohn Marino int	priv_move_log(void);
4186d7f5d3SJohn Marino pcap_t *pcap_open_live_fd(int fd, int snaplen, char *ebuf);
4286d7f5d3SJohn Marino 
4386d7f5d3SJohn Marino void set_pcap_filter(void);
4486d7f5d3SJohn Marino /* File descriptor send/recv */
4586d7f5d3SJohn Marino void send_fd(int, int);
4686d7f5d3SJohn Marino int  receive_fd(int);
4786d7f5d3SJohn Marino 
4886d7f5d3SJohn Marino extern int Debug;
49