-
Notifications
You must be signed in to change notification settings - Fork 2
/
flowd.h
110 lines (95 loc) · 3.08 KB
/
flowd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* $Id$ */
/*
* Copyright (c) 2004,2005 Damien Miller <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FLOWD_H
#define _FLOWD_H
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
#include <syslog.h>
#include "flowd-common.h"
#include "sys-queue.h"
#include "addr.h"
#include "filter.h"
#ifndef PROGNAME
#define PROGNAME "flowd"
#endif
#define DEFAULT_CONFIG SYSCONFDIR "/flowd.conf"
#define DEFAULT_PIDFILE PIDFILEDIR "/flowd.pid"
#define PRIVSEP_USER "_flowd"
/* Initial stateholding limits */
/* XXX these are not actually tunable yet */
#define DEFAULT_MAX_PEERS 128
#define DEFAULT_MAX_TEMPLATES 8
#define DEFAULT_MAX_TEMPLATE_LEN 1024
#define DEFAULT_MAX_SOURCES 64
struct allowed_device {
struct xaddr addr;
u_int masklen;
TAILQ_ENTRY(allowed_device) entry;
};
TAILQ_HEAD(allowed_devices, allowed_device);
struct listen_addr {
struct xaddr addr;
u_int16_t port;
int fd;
size_t bufsiz;
TAILQ_ENTRY(listen_addr) entry;
};
TAILQ_HEAD(listen_addrs, listen_addr);
struct join_group {
struct xaddr addr;
/* XXX: add interface name */
TAILQ_ENTRY(join_group) entry;
};
TAILQ_HEAD(join_groups, join_group);
struct forward_addr {
struct xaddr addr;
u_int16_t port;
int fd;
size_t bufsiz;
TAILQ_ENTRY(forward_addr) entry;
};
TAILQ_HEAD(forward_addrs, forward_addr);
#define FLOWD_OPT_DONT_FORK (1)
#define FLOWD_OPT_VERBOSE (1<<1)
#define FLOWD_OPT_INSECURE (1<<2)
struct flowd_config {
char *log_file;
char *log_socket;
size_t log_socket_bufsiz;
char *pid_file;
u_int32_t store_mask;
u_int32_t opts;
struct listen_addrs listen_addrs;
struct forward_addrs forward_addrs;
struct filter_list filter_list;
struct allowed_devices allowed_devices;
struct join_groups join_groups;
};
/* parse.y */
int parse_config(const char *, FILE *, struct flowd_config *, int);
int cmdline_symset(char *);
void dump_config(struct flowd_config *, const char *, int);
/* log.c */
void logclose(void);
void loginit(const char *ident, int to_stderr, int debug_flag);
void vlogit(int level, const char *fmt, va_list args);
void logit(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void logitm(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void logerr(const char *fmt, ...) __dead __attribute__((format(printf, 1, 2)));
void logerrx(const char *fmt, ...) __dead __attribute__((format(printf, 1, 2)));
#endif /* _FLOWD_H */