]>
Commit | Line | Data |
---|---|---|
4f04a76b DL |
1 | /* |
2 | * libfrr overall management functions | |
3 | * | |
4 | * Copyright (C) 2016 David Lamparter for NetDEF, Inc. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the Free | |
8 | * Software Foundation; either version 2 of the License, or (at your option) | |
9 | * any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
14 | * more details. | |
15 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
4f04a76b DL |
19 | */ |
20 | ||
21 | #ifndef _ZEBRA_FRR_H | |
22 | #define _ZEBRA_FRR_H | |
23 | ||
24 | #include "sigevent.h" | |
25 | #include "privs.h" | |
26 | #include "thread.h" | |
27 | #include "log.h" | |
28 | #include "getopt.h" | |
30771d65 | 29 | #include "module.h" |
a5b38c5b | 30 | #include "hook.h" |
4f04a76b DL |
31 | |
32 | #define FRR_NO_PRIVSEP (1 << 0) | |
33 | #define FRR_NO_TCPVTY (1 << 1) | |
857b5446 | 34 | #define FRR_LIMITED_CLI (1 << 2) |
eb05883f DL |
35 | #define FRR_NO_CFG_PID_DRY (1 << 3) |
36 | #define FRR_NO_ZCLIENT (1 << 4) | |
4f04a76b DL |
37 | |
38 | struct frr_daemon_info { | |
39 | unsigned flags; | |
40 | ||
41 | const char *progname; | |
eb05883f | 42 | const char *name; |
bf1013e6 | 43 | const char *logname; |
4f04a76b | 44 | unsigned short instance; |
30771d65 | 45 | struct frrmod_runtime *module; |
4f04a76b DL |
46 | |
47 | char *vty_addr; | |
48 | int vty_port; | |
49 | char *vty_sock_path; | |
eb05883f DL |
50 | bool dryrun; |
51 | bool daemon_mode; | |
cff2b211 | 52 | bool terminal; |
eb05883f DL |
53 | const char *config_file; |
54 | const char *pid_file; | |
55 | const char *vty_path; | |
80b4df3b | 56 | const char *module_path; |
4f04a76b DL |
57 | |
58 | const char *proghelp; | |
59 | void (*printhelp)(FILE *target); | |
60 | const char *copyright; | |
16077f2f | 61 | char startinfo[128]; |
4f04a76b DL |
62 | |
63 | struct quagga_signal_t *signals; | |
64 | size_t n_signals; | |
65 | ||
66 | struct zebra_privs_t *privs; | |
67 | }; | |
68 | ||
69 | /* execname is the daemon's executable (and pidfile and configfile) name, | |
70 | * i.e. "zebra" or "bgpd" | |
71 | * constname is the daemons source-level name, primarily for the logging ID, | |
72 | * i.e. "ZEBRA" or "BGP" | |
73 | * | |
74 | * note that this macro is also a latch-on point for other changes (e.g. | |
30771d65 | 75 | * upcoming module support) that need to place some per-daemon things. Each |
4f04a76b DL |
76 | * daemon should have one of these. |
77 | */ | |
d62a17ae | 78 | #define FRR_DAEMON_INFO(execname, constname, ...) \ |
79 | static struct frr_daemon_info execname##_di = {.name = #execname, \ | |
80 | .logname = #constname, \ | |
81 | .module = THIS_MODULE, \ | |
82 | __VA_ARGS__}; \ | |
83 | FRR_COREMOD_SETUP(.name = #execname, \ | |
84 | .description = #execname " daemon", \ | |
85 | .version = FRR_VERSION, ) \ | |
86 | /* end */ | |
87 | ||
88 | extern void frr_preinit(struct frr_daemon_info *daemon, int argc, char **argv); | |
89 | extern void frr_opt_add(const char *optstr, const struct option *longopts, | |
90 | const char *helpstr); | |
91 | extern int frr_getopt(int argc, char *const argv[], int *longindex); | |
4f04a76b DL |
92 | extern void frr_help_exit(int status); |
93 | ||
94 | extern struct thread_master *frr_init(void); | |
95 | ||
d62a17ae | 96 | DECLARE_HOOK(frr_late_init, (struct thread_master * tm), (tm)) |
eb05883f DL |
97 | extern void frr_config_fork(void); |
98 | ||
99 | extern void frr_vty_serv(void); | |
100 | ||
16077f2f DL |
101 | /* note: contains call to frr_vty_serv() */ |
102 | extern void frr_run(struct thread_master *master); | |
103 | ||
689f5a8c DL |
104 | extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len, |
105 | const char *path); | |
106 | ||
eb05883f | 107 | extern char config_default[256]; |
689f5a8c | 108 | extern char frr_zclientpath[256]; |
eb05883f DL |
109 | extern const char frr_sysconfdir[]; |
110 | extern const char frr_vtydir[]; | |
80b4df3b | 111 | extern const char frr_moduledir[]; |
4f04a76b | 112 | |
b85120bc DL |
113 | extern char frr_protoname[]; |
114 | extern char frr_protonameinst[]; | |
115 | ||
4f04a76b | 116 | #endif /* _ZEBRA_FRR_H */ |