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