1 /* Zebra daemon server header.
2 * Copyright (C) 1997, 98 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
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
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.
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
21 #ifndef _ZEBRA_ZSERV_H
22 #define _ZEBRA_ZSERV_H
26 #include "workqueue.h"
33 #include "zebra/zebra_ns.h"
34 #include "zebra/zebra_pw.h"
35 //#include "zebra/zebra_pbr.h"
37 /* Default port information. */
38 #define ZEBRA_VTY_PORT 2601
40 /* Default configuration filename. */
41 #define DEFAULT_CONFIG_FILE "zebra.conf"
43 #define ZEBRA_RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
45 /* Client structure. */
47 /* Client file descriptor. */
50 /* Input/output buffer to the client. */
51 struct stream_fifo
*ibuf_fifo
;
52 struct stream_fifo
*obuf_fifo
;
54 /* Private I/O buffers */
55 struct stream
*ibuf_work
;
56 struct stream
*obuf_work
;
58 /* Buffer of data waiting to be written to client. */
61 /* Threads for read/write. */
62 struct thread
*t_read
;
63 struct thread
*t_write
;
65 /* Thread for delayed close. */
66 struct thread
*t_suicide
;
68 /* default routing table this client munges */
71 /* This client's redistribute flag. */
72 struct redist_proto mi_redist
[AFI_MAX
][ZEBRA_ROUTE_MAX
];
73 vrf_bitmap_t redist
[AFI_MAX
][ZEBRA_ROUTE_MAX
];
75 /* Redistribute default route flag. */
76 vrf_bitmap_t redist_default
;
78 /* Interface information. */
81 /* Router-id information. */
86 /* client's protocol */
88 unsigned short instance
;
89 uint8_t is_synchronous
;
92 uint32_t redist_v4_add_cnt
;
93 uint32_t redist_v4_del_cnt
;
94 uint32_t redist_v6_add_cnt
;
95 uint32_t redist_v6_del_cnt
;
96 uint32_t v4_route_add_cnt
;
97 uint32_t v4_route_upd8_cnt
;
98 uint32_t v4_route_del_cnt
;
99 uint32_t v6_route_add_cnt
;
100 uint32_t v6_route_del_cnt
;
101 uint32_t v6_route_upd8_cnt
;
102 uint32_t connected_rt_add_cnt
;
103 uint32_t connected_rt_del_cnt
;
109 uint32_t bfd_peer_add_cnt
;
110 uint32_t bfd_peer_upd8_cnt
;
111 uint32_t bfd_peer_del_cnt
;
112 uint32_t bfd_peer_replay_cnt
;
115 uint32_t if_vrfchg_cnt
;
116 uint32_t bfd_client_reg_cnt
;
119 uint32_t l3vniadd_cnt
;
120 uint32_t l3vnidel_cnt
;
121 uint32_t macipadd_cnt
;
122 uint32_t macipdel_cnt
;
123 uint32_t prefixadd_cnt
;
124 uint32_t prefixdel_cnt
;
127 time_t last_read_time
;
128 time_t last_write_time
;
130 time_t nh_dereg_time
;
131 time_t nh_last_upd_time
;
137 #define ZAPI_HANDLER_ARGS \
138 struct zserv *client, struct zmsghdr *hdr, struct stream *msg, \
139 struct zebra_vrf *zvrf
144 struct thread_master
*master
;
145 struct list
*client_list
;
148 uint32_t rtm_table_default
;
151 #define ZEBRA_RIB_PROCESS_HOLD_TIME 10
152 struct work_queue
*ribq
;
153 struct meta_queue
*mq
;
156 struct work_queue
*lsp_process_q
;
158 #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10
159 uint32_t packets_to_process
;
161 extern struct zebra_t zebrad
;
162 extern unsigned int multipath_num
;
165 extern void zserv_init(void);
166 extern void zebra_zserv_socket_init(char *path
);
168 extern int zsend_vrf_add(struct zserv
*, struct zebra_vrf
*);
169 extern int zsend_vrf_delete(struct zserv
*, struct zebra_vrf
*);
171 extern int zsend_interface_add(struct zserv
*, struct interface
*);
172 extern int zsend_interface_delete(struct zserv
*, struct interface
*);
173 extern int zsend_interface_addresses(struct zserv
*, struct interface
*);
174 extern int zsend_interface_address(int, struct zserv
*, struct interface
*,
176 extern void nbr_connected_add_ipv6(struct interface
*, struct in6_addr
*);
177 extern void nbr_connected_delete_ipv6(struct interface
*, struct in6_addr
*);
178 extern int zsend_interface_update(int, struct zserv
*, struct interface
*);
179 extern int zsend_redistribute_route(int, struct zserv
*, struct prefix
*,
180 struct prefix
*, struct route_entry
*);
181 extern int zsend_router_id_update(struct zserv
*, struct prefix
*, vrf_id_t
);
182 extern int zsend_interface_vrf_update(struct zserv
*, struct interface
*,
185 extern int zsend_interface_link_params(struct zserv
*, struct interface
*);
186 extern int zsend_pw_update(struct zserv
*, struct zebra_pw
*);
188 extern int zsend_route_notify_owner(struct route_entry
*re
, struct prefix
*p
,
189 enum zapi_route_notify_owner note
);
191 struct zebra_pbr_ipset
;
192 struct zebra_pbr_ipset_entry
;
193 struct zebra_pbr_iptable
;
194 struct zebra_pbr_rule
;
195 extern void zsend_rule_notify_owner(struct zebra_pbr_rule
*rule
,
196 enum zapi_rule_notify_owner note
);
197 extern void zsend_ipset_notify_owner(
198 struct zebra_pbr_ipset
*ipset
,
199 enum zapi_ipset_notify_owner note
);
200 extern void zsend_ipset_entry_notify_owner(
201 struct zebra_pbr_ipset_entry
*ipset
,
202 enum zapi_ipset_entry_notify_owner note
);
203 extern void zsend_iptable_notify_owner(
204 struct zebra_pbr_iptable
*iptable
,
205 enum zapi_iptable_notify_owner note
);
207 extern void zserv_nexthop_num_warn(const char *, const struct prefix
*,
209 extern int zebra_server_send_message(struct zserv
*client
, struct stream
*msg
);
211 extern struct zserv
*zebra_find_client(uint8_t proto
, unsigned short instance
);
213 #if defined(HANDLE_ZAPI_FUZZING)
214 extern void zserv_read_file(char *input
);
217 #endif /* _ZEBRA_ZEBRA_H */