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"
32 #include "zebra/zebra_ns.h"
33 #include "zebra/zebra_pw.h"
35 /* Default port information. */
36 #define ZEBRA_VTY_PORT 2601
38 /* Default configuration filename. */
39 #define DEFAULT_CONFIG_FILE "zebra.conf"
41 #define ZEBRA_RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
43 /* Client structure. */
45 /* Client file descriptor. */
48 /* Input/output buffer to the client. */
52 /* Buffer of data waiting to be written to client. */
55 /* Threads for read/write. */
56 struct thread
*t_read
;
57 struct thread
*t_write
;
59 /* Thread for delayed close. */
60 struct thread
*t_suicide
;
62 /* default routing table this client munges */
65 /* This client's redistribute flag. */
66 struct redist_proto mi_redist
[AFI_MAX
][ZEBRA_ROUTE_MAX
];
67 vrf_bitmap_t redist
[AFI_MAX
][ZEBRA_ROUTE_MAX
];
69 /* Redistribute default route flag. */
70 vrf_bitmap_t redist_default
;
72 /* Interface information. */
75 /* Router-id information. */
78 /* client's protocol */
81 u_char is_synchronous
;
84 u_int32_t redist_v4_add_cnt
;
85 u_int32_t redist_v4_del_cnt
;
86 u_int32_t redist_v6_add_cnt
;
87 u_int32_t redist_v6_del_cnt
;
88 u_int32_t v4_route_add_cnt
;
89 u_int32_t v4_route_upd8_cnt
;
90 u_int32_t v4_route_del_cnt
;
91 u_int32_t v6_route_add_cnt
;
92 u_int32_t v6_route_del_cnt
;
93 u_int32_t v6_route_upd8_cnt
;
94 u_int32_t connected_rt_add_cnt
;
95 u_int32_t connected_rt_del_cnt
;
100 u_int32_t if_bfd_cnt
;
101 u_int32_t bfd_peer_add_cnt
;
102 u_int32_t bfd_peer_upd8_cnt
;
103 u_int32_t bfd_peer_del_cnt
;
104 u_int32_t bfd_peer_replay_cnt
;
105 u_int32_t vrfadd_cnt
;
106 u_int32_t vrfdel_cnt
;
107 u_int32_t if_vrfchg_cnt
;
108 u_int32_t bfd_client_reg_cnt
;
109 u_int32_t vniadd_cnt
;
110 u_int32_t vnidel_cnt
;
111 u_int32_t macipadd_cnt
;
112 u_int32_t macipdel_cnt
;
115 time_t last_read_time
;
116 time_t last_write_time
;
118 time_t nh_dereg_time
;
119 time_t nh_last_upd_time
;
128 struct thread_master
*master
;
129 struct list
*client_list
;
132 u_int32_t rtm_table_default
;
135 #define ZEBRA_RIB_PROCESS_HOLD_TIME 10
136 struct work_queue
*ribq
;
137 struct meta_queue
*mq
;
140 struct work_queue
*lsp_process_q
;
142 #define ZEBRA_ZAPI_PACKETS_TO_PROCESS 10
143 u_int32_t packets_to_process
;
145 extern struct zebra_t zebrad
;
146 extern unsigned int multipath_num
;
149 extern void zebra_init(void);
150 extern void zebra_if_init(void);
151 extern void zebra_zserv_socket_init(char *path
);
152 extern void hostinfo_get(void);
153 extern void rib_init(void);
154 extern void interface_list(struct zebra_ns
*);
155 extern void route_read(struct zebra_ns
*);
156 extern void macfdb_read(struct zebra_ns
*);
157 extern void macfdb_read_for_bridge(struct zebra_ns
*, struct interface
*,
159 extern void neigh_read(struct zebra_ns
*);
160 extern void neigh_read_for_vlan(struct zebra_ns
*, struct interface
*);
161 extern void kernel_init(struct zebra_ns
*);
162 extern void kernel_terminate(struct zebra_ns
*);
163 extern void zebra_route_map_init(void);
164 extern void zebra_vty_init(void);
166 extern int zsend_vrf_add(struct zserv
*, struct zebra_vrf
*);
167 extern int zsend_vrf_delete(struct zserv
*, struct zebra_vrf
*);
169 extern int zsend_interface_add(struct zserv
*, struct interface
*);
170 extern int zsend_interface_delete(struct zserv
*, struct interface
*);
171 extern int zsend_interface_addresses(struct zserv
*, struct interface
*);
172 extern int zsend_interface_address(int, struct zserv
*, struct interface
*,
174 extern void nbr_connected_add_ipv6(struct interface
*, struct in6_addr
*);
175 extern void nbr_connected_delete_ipv6(struct interface
*, struct in6_addr
*);
176 extern int zsend_interface_update(int, struct zserv
*, struct interface
*);
177 extern int zsend_redistribute_route(int, struct zserv
*, struct prefix
*,
178 struct prefix
*, struct route_entry
*);
179 extern int zsend_router_id_update(struct zserv
*, struct prefix
*, vrf_id_t
);
180 extern int zsend_interface_vrf_update(struct zserv
*, struct interface
*,
183 extern int zsend_interface_link_params(struct zserv
*, struct interface
*);
184 extern int zsend_pw_update(struct zserv
*, struct zebra_pw
*);
188 extern void zserv_create_header(struct stream
*s
, uint16_t cmd
,
190 extern void zserv_nexthop_num_warn(const char *, const struct prefix
*,
192 extern int zebra_server_send_message(struct zserv
*client
);
194 extern struct zserv
*zebra_find_client(u_char proto
);
196 #endif /* _ZEBRA_ZEBRA_H */