]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* Zebra daemon server header. |
2 | * Copyright (C) 1997, 98 Kunihiro Ishiguro | |
3 | * | |
4 | * This file is part of GNU Zebra. | |
5 | * | |
6 | * GNU Zebra 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 | |
8 | * Free Software Foundation; either version 2, or (at your option) any | |
9 | * later version. | |
10 | * | |
11 | * GNU Zebra is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for 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 | |
718e3744 | 19 | */ |
20 | ||
21 | #ifndef _ZEBRA_ZSERV_H | |
22 | #define _ZEBRA_ZSERV_H | |
23 | ||
5b73a671 | 24 | #include "rib.h" |
ec1a4283 | 25 | #include "if.h" |
4d38fdb4 | 26 | #include "workqueue.h" |
82f97584 | 27 | #include "vrf.h" |
518f0eb1 | 28 | #include "routemap.h" |
4e3afb14 | 29 | #include "vty.h" |
7c8ff89e | 30 | #include "zclient.h" |
5b73a671 | 31 | |
7c551956 | 32 | #include "zebra/zebra_ns.h" |
6833ae01 | 33 | #include "zebra/zebra_pw.h" |
b6c5d343 | 34 | //#include "zebra/zebra_pbr.h" |
6833ae01 | 35 | |
718e3744 | 36 | /* Default port information. */ |
718e3744 | 37 | #define ZEBRA_VTY_PORT 2601 |
718e3744 | 38 | |
39 | /* Default configuration filename. */ | |
40 | #define DEFAULT_CONFIG_FILE "zebra.conf" | |
41 | ||
518f0eb1 DS |
42 | #define ZEBRA_RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ |
43 | ||
718e3744 | 44 | /* Client structure. */ |
d62a17ae | 45 | struct zserv { |
46 | /* Client file descriptor. */ | |
47 | int sock; | |
48 | ||
49 | /* Input/output buffer to the client. */ | |
50 | struct stream *ibuf; | |
51 | struct stream *obuf; | |
52 | ||
53 | /* Buffer of data waiting to be written to client. */ | |
54 | struct buffer *wb; | |
55 | ||
56 | /* Threads for read/write. */ | |
57 | struct thread *t_read; | |
58 | struct thread *t_write; | |
59 | ||
60 | /* Thread for delayed close. */ | |
61 | struct thread *t_suicide; | |
62 | ||
63 | /* default routing table this client munges */ | |
64 | int rtm_table; | |
65 | ||
66 | /* This client's redistribute flag. */ | |
67 | struct redist_proto mi_redist[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
68 | vrf_bitmap_t redist[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
69 | ||
70 | /* Redistribute default route flag. */ | |
71 | vrf_bitmap_t redist_default; | |
72 | ||
73 | /* Interface information. */ | |
74 | vrf_bitmap_t ifinfo; | |
75 | ||
76 | /* Router-id information. */ | |
77 | vrf_bitmap_t ridinfo; | |
78 | ||
e1a1880d DS |
79 | bool notify_owner; |
80 | ||
d62a17ae | 81 | /* client's protocol */ |
82 | u_char proto; | |
83 | u_short instance; | |
84 | u_char is_synchronous; | |
85 | ||
86 | /* Statistics */ | |
87 | u_int32_t redist_v4_add_cnt; | |
88 | u_int32_t redist_v4_del_cnt; | |
89 | u_int32_t redist_v6_add_cnt; | |
90 | u_int32_t redist_v6_del_cnt; | |
91 | u_int32_t v4_route_add_cnt; | |
92 | u_int32_t v4_route_upd8_cnt; | |
93 | u_int32_t v4_route_del_cnt; | |
94 | u_int32_t v6_route_add_cnt; | |
95 | u_int32_t v6_route_del_cnt; | |
96 | u_int32_t v6_route_upd8_cnt; | |
97 | u_int32_t connected_rt_add_cnt; | |
98 | u_int32_t connected_rt_del_cnt; | |
99 | u_int32_t ifup_cnt; | |
100 | u_int32_t ifdown_cnt; | |
101 | u_int32_t ifadd_cnt; | |
102 | u_int32_t ifdel_cnt; | |
103 | u_int32_t if_bfd_cnt; | |
104 | u_int32_t bfd_peer_add_cnt; | |
105 | u_int32_t bfd_peer_upd8_cnt; | |
106 | u_int32_t bfd_peer_del_cnt; | |
107 | u_int32_t bfd_peer_replay_cnt; | |
108 | u_int32_t vrfadd_cnt; | |
109 | u_int32_t vrfdel_cnt; | |
110 | u_int32_t if_vrfchg_cnt; | |
111 | u_int32_t bfd_client_reg_cnt; | |
112 | u_int32_t vniadd_cnt; | |
113 | u_int32_t vnidel_cnt; | |
b7cfce93 MK |
114 | u_int32_t l3vniadd_cnt; |
115 | u_int32_t l3vnidel_cnt; | |
d62a17ae | 116 | u_int32_t macipadd_cnt; |
117 | u_int32_t macipdel_cnt; | |
31310b25 MK |
118 | u_int32_t prefixadd_cnt; |
119 | u_int32_t prefixdel_cnt; | |
d62a17ae | 120 | |
121 | time_t connect_time; | |
122 | time_t last_read_time; | |
123 | time_t last_write_time; | |
124 | time_t nh_reg_time; | |
125 | time_t nh_dereg_time; | |
126 | time_t nh_last_upd_time; | |
127 | ||
128 | int last_read_cmd; | |
129 | int last_write_cmd; | |
718e3744 | 130 | }; |
131 | ||
b21b19c5 | 132 | /* Zebra instance */ |
d62a17ae | 133 | struct zebra_t { |
134 | /* Thread master */ | |
135 | struct thread_master *master; | |
136 | struct list *client_list; | |
b21b19c5 | 137 | |
d62a17ae | 138 | /* default table */ |
139 | u_int32_t rtm_table_default; | |
4d38fdb4 | 140 | |
996c9314 LB |
141 | /* rib work queue */ |
142 | #define ZEBRA_RIB_PROCESS_HOLD_TIME 10 | |
d62a17ae | 143 | struct work_queue *ribq; |
144 | struct meta_queue *mq; | |
40c7bdb0 | 145 | |
d62a17ae | 146 | /* LSP work queue */ |
147 | struct work_queue *lsp_process_q; | |
a37ef435 | 148 | |
996c9314 | 149 | #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10 |
a37ef435 | 150 | u_int32_t packets_to_process; |
b21b19c5 | 151 | }; |
44e9909d | 152 | extern struct zebra_t zebrad; |
37fe7731 | 153 | extern unsigned int multipath_num; |
b21b19c5 | 154 | |
718e3744 | 155 | /* Prototypes. */ |
5f145fb8 | 156 | extern void zserv_init(void); |
d62a17ae | 157 | extern void zebra_zserv_socket_init(char *path); |
d62a17ae | 158 | |
159 | extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *); | |
160 | extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *); | |
161 | ||
162 | extern int zsend_interface_add(struct zserv *, struct interface *); | |
163 | extern int zsend_interface_delete(struct zserv *, struct interface *); | |
164 | extern int zsend_interface_addresses(struct zserv *, struct interface *); | |
165 | extern int zsend_interface_address(int, struct zserv *, struct interface *, | |
166 | struct connected *); | |
167 | extern void nbr_connected_add_ipv6(struct interface *, struct in6_addr *); | |
168 | extern void nbr_connected_delete_ipv6(struct interface *, struct in6_addr *); | |
169 | extern int zsend_interface_update(int, struct zserv *, struct interface *); | |
170 | extern int zsend_redistribute_route(int, struct zserv *, struct prefix *, | |
171 | struct prefix *, struct route_entry *); | |
172 | extern int zsend_router_id_update(struct zserv *, struct prefix *, vrf_id_t); | |
173 | extern int zsend_interface_vrf_update(struct zserv *, struct interface *, | |
174 | vrf_id_t); | |
175 | ||
176 | extern int zsend_interface_link_params(struct zserv *, struct interface *); | |
6833ae01 | 177 | extern int zsend_pw_update(struct zserv *, struct zebra_pw *); |
16f1b9ee | 178 | |
28610f7e | 179 | extern int zsend_route_notify_owner(struct route_entry *re, struct prefix *p, |
7ea7b86e DS |
180 | enum zapi_route_notify_owner note); |
181 | ||
b6c5d343 DS |
182 | struct zebra_pbr_rule; |
183 | extern void zsend_rule_notify_owner(struct zebra_pbr_rule *rule, | |
184 | enum zapi_rule_notify_owner note); | |
185 | ||
d62a17ae | 186 | extern void zserv_nexthop_num_warn(const char *, const struct prefix *, |
187 | const unsigned int); | |
fb018d25 DS |
188 | extern int zebra_server_send_message(struct zserv *client); |
189 | ||
019a82cb | 190 | extern struct zserv *zebra_find_client(u_char proto, u_short instance); |
8ed6821e | 191 | |
411314ed DS |
192 | #if defined(HANDLE_ZAPI_FUZZING) |
193 | extern void zserv_read_file(char *input); | |
194 | #endif | |
195 | ||
718e3744 | 196 | #endif /* _ZEBRA_ZEBRA_H */ |