1 /* $Id: flowd.h,v 1.19 2007/10/24 01:04:10 djm Exp $ */ 2 3 /* 4 * Copyright (c) 2004,2005 Damien Miller <djm@mindrot.org> 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 #ifndef _FLOWD_H 20 #define _FLOWD_H 21 22 #include <sys/types.h> 23 #include <stdio.h> 24 #include <stdarg.h> 25 #include <syslog.h> 26 27 #include "flowd-common.h" 28 #include "sys-queue.h" 29 #include "addr.h" 30 #include "filter.h" 31 32 #ifndef PROGNAME 33 #define PROGNAME "flowd" 34 #endif 35 36 #define DEFAULT_CONFIG SYSCONFDIR "/flowd.conf" 37 #define DEFAULT_PIDFILE PIDFILEDIR "/flowd.pid" 38 #define PRIVSEP_USER "_flowd" 39 40 /* Initial stateholding limits */ 41 /* XXX these are not actually tunable yet */ 42 #define DEFAULT_MAX_PEERS 128 43 #define DEFAULT_MAX_TEMPLATES 8 44 #define DEFAULT_MAX_TEMPLATE_LEN 1024 45 #define DEFAULT_MAX_SOURCES 64 46 47 struct allowed_device { 48 struct xaddr addr; 49 u_int masklen; 50 TAILQ_ENTRY(allowed_device) entry; 51 }; 52 TAILQ_HEAD(allowed_devices, allowed_device); 53 54 struct listen_addr { 55 struct xaddr addr; 56 u_int16_t port; 57 int fd; 58 size_t bufsiz; 59 TAILQ_ENTRY(listen_addr) entry; 60 }; 61 TAILQ_HEAD(listen_addrs, listen_addr); 62 63 struct join_group { 64 struct xaddr addr; 65 /* XXX: add interface name */ 66 TAILQ_ENTRY(join_group) entry; 67 }; 68 TAILQ_HEAD(join_groups, join_group); 69 70 #define FLOWD_OPT_DONT_FORK (1) 71 #define FLOWD_OPT_VERBOSE (1<<1) 72 #define FLOWD_OPT_INSECURE (1<<2) 73 struct flowd_config { 74 char *log_file; 75 char *log_socket; 76 size_t log_socket_bufsiz; 77 char *pid_file; 78 u_int32_t store_mask; 79 u_int32_t opts; 80 struct listen_addrs listen_addrs; 81 struct filter_list filter_list; 82 struct allowed_devices allowed_devices; 83 struct join_groups join_groups; 84 }; 85 86 /* parse.y */ 87 int parse_config(const char *, FILE *, struct flowd_config *, int); 88 int cmdline_symset(char *); 89 void dump_config(struct flowd_config *, const char *, int); 90 91 /* log.c */ 92 void logclose(void); 93 void loginit(const char *ident, int to_stderr, int debug_flag); 94 void vlogit(int level, const char *fmt, va_list args); 95 void logit(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); 96 void logitm(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); 97 void logerr(const char *fmt, ...) __dead __attribute__((format(printf, 1, 2))); 98 void logerrx(const char *fmt, ...) __dead __attribute__((format(printf, 1, 2))); 99 100 #endif /* _FLOWD_H */ 101