]>
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 | * | |
16 | * You should have received a copy of the GNU General Public License along with | |
17 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
18 | * Place, Suite 330, Boston, MA 02111-1307 USA | |
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" |
4f04a76b DL |
30 | |
31 | #define FRR_NO_PRIVSEP (1 << 0) | |
32 | #define FRR_NO_TCPVTY (1 << 1) | |
857b5446 | 33 | #define FRR_LIMITED_CLI (1 << 2) |
eb05883f DL |
34 | #define FRR_NO_CFG_PID_DRY (1 << 3) |
35 | #define FRR_NO_ZCLIENT (1 << 4) | |
4f04a76b DL |
36 | |
37 | struct frr_daemon_info { | |
38 | unsigned flags; | |
39 | ||
40 | const char *progname; | |
eb05883f | 41 | const char *name; |
bf1013e6 | 42 | const char *logname; |
4f04a76b | 43 | unsigned short instance; |
30771d65 | 44 | struct frrmod_runtime *module; |
4f04a76b DL |
45 | |
46 | char *vty_addr; | |
47 | int vty_port; | |
48 | char *vty_sock_path; | |
eb05883f DL |
49 | bool dryrun; |
50 | bool daemon_mode; | |
51 | const char *config_file; | |
52 | const char *pid_file; | |
53 | const char *vty_path; | |
4f04a76b DL |
54 | |
55 | const char *proghelp; | |
56 | void (*printhelp)(FILE *target); | |
57 | const char *copyright; | |
16077f2f | 58 | char startinfo[128]; |
4f04a76b DL |
59 | |
60 | struct quagga_signal_t *signals; | |
61 | size_t n_signals; | |
62 | ||
63 | struct zebra_privs_t *privs; | |
64 | }; | |
65 | ||
66 | /* execname is the daemon's executable (and pidfile and configfile) name, | |
67 | * i.e. "zebra" or "bgpd" | |
68 | * constname is the daemons source-level name, primarily for the logging ID, | |
69 | * i.e. "ZEBRA" or "BGP" | |
70 | * | |
71 | * note that this macro is also a latch-on point for other changes (e.g. | |
30771d65 | 72 | * upcoming module support) that need to place some per-daemon things. Each |
4f04a76b DL |
73 | * daemon should have one of these. |
74 | */ | |
75 | #define FRR_DAEMON_INFO(execname, constname, ...) \ | |
76 | static struct frr_daemon_info execname ##_di = { \ | |
eb05883f | 77 | .name = # execname, \ |
bf1013e6 | 78 | .logname = # constname, \ |
30771d65 | 79 | .module = THIS_MODULE, \ |
4f04a76b | 80 | __VA_ARGS__ \ |
30771d65 DL |
81 | }; \ |
82 | FRR_COREMOD_SETUP( \ | |
83 | .name = # execname, \ | |
84 | .description = # execname " daemon", \ | |
85 | .version = FRR_VERSION, \ | |
86 | ) \ | |
87 | /* end */ | |
4f04a76b DL |
88 | |
89 | extern void frr_preinit(struct frr_daemon_info *daemon, | |
90 | int argc, char **argv); | |
91 | extern void frr_opt_add(const char *optstr, | |
92 | const struct option *longopts, const char *helpstr); | |
93 | extern int frr_getopt(int argc, char * const argv[], int *longindex); | |
94 | extern void frr_help_exit(int status); | |
95 | ||
96 | extern struct thread_master *frr_init(void); | |
97 | ||
eb05883f DL |
98 | extern void frr_config_fork(void); |
99 | ||
100 | extern void frr_vty_serv(void); | |
101 | ||
16077f2f DL |
102 | /* note: contains call to frr_vty_serv() */ |
103 | extern void frr_run(struct thread_master *master); | |
104 | ||
eb05883f DL |
105 | extern char config_default[256]; |
106 | extern const char frr_sysconfdir[]; | |
107 | extern const char frr_vtydir[]; | |
4f04a76b DL |
108 | |
109 | #endif /* _ZEBRA_FRR_H */ |