1 /* $OpenBSD: pflogd.h,v 1.2 2004/01/15 20:15:14 canacar Exp $ */ 2 /* $DragonFly: src/usr.sbin/pflogd/pflogd.h,v 1.1 2004/09/21 21:25:28 joerg 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 #include <limits.h> 21 #include <pcap.h> 22 23 #define DEF_SNAPLEN 116 /* default plus allow for larger header of pflog */ 24 #define PCAP_TO_MS 500 /* pcap read timeout (ms) */ 25 #define PCAP_NUM_PKTS 1000 /* max number of packets to process at each loop */ 26 #define PCAP_OPT_FIL 1 /* filter optimization */ 27 #define FLUSH_DELAY 60 /* flush delay */ 28 29 #define PFLOGD_LOG_FILE "/var/log/pflog" 30 #define PFLOGD_DEFAULT_IF "pflog0" 31 32 #define PFLOGD_MAXSNAPLEN INT_MAX 33 #define PFLOGD_BUFSIZE 65536 /* buffer size for incoming packets */ 34 35 void logmsg(int priority, const char *message, ...); 36 37 /* Privilege separation */ 38 int priv_init(void); 39 int priv_set_snaplen(int snaplen); 40 int priv_open_log(void); 41 pcap_t *pcap_open_live_fd(int fd, int snaplen, char *ebuf); 42 43 void set_pcap_filter(void); 44 /* File descriptor send/recv */ 45 void send_fd(int, int); 46 int receive_fd(int); 47 48 extern int Debug; 49