]>
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 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | * 02111-1307, USA. | |
20 | */ | |
21 | ||
22 | #ifndef _ZEBRA_ZSERV_H | |
23 | #define _ZEBRA_ZSERV_H | |
24 | ||
5b73a671 | 25 | #include "rib.h" |
ec1a4283 | 26 | #include "if.h" |
4d38fdb4 | 27 | #include "workqueue.h" |
518f0eb1 | 28 | #include "routemap.h" |
4e3afb14 | 29 | #include "vty.h" |
7c8ff89e | 30 | #include "zclient.h" |
7076bb2f | 31 | #include "vrf.h" |
5b73a671 | 32 | |
718e3744 | 33 | /* Default port information. */ |
718e3744 | 34 | #define ZEBRA_VTY_PORT 2601 |
718e3744 | 35 | |
36 | /* Default configuration filename. */ | |
37 | #define DEFAULT_CONFIG_FILE "zebra.conf" | |
38 | ||
518f0eb1 DS |
39 | #define ZEBRA_RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ |
40 | ||
718e3744 | 41 | /* Client structure. */ |
42 | struct zserv | |
43 | { | |
44 | /* Client file descriptor. */ | |
45 | int sock; | |
46 | ||
47 | /* Input/output buffer to the client. */ | |
48 | struct stream *ibuf; | |
49 | struct stream *obuf; | |
50 | ||
719e9741 | 51 | /* Buffer of data waiting to be written to client. */ |
52 | struct buffer *wb; | |
53 | ||
718e3744 | 54 | /* Threads for read/write. */ |
55 | struct thread *t_read; | |
56 | struct thread *t_write; | |
57 | ||
719e9741 | 58 | /* Thread for delayed close. */ |
59 | struct thread *t_suicide; | |
60 | ||
718e3744 | 61 | /* default routing table this client munges */ |
62 | int rtm_table; | |
63 | ||
64 | /* This client's redistribute flag. */ | |
7076bb2f FL |
65 | struct redist_proto mi_redist[AFI_MAX][ZEBRA_ROUTE_MAX]; |
66 | vrf_bitmap_t redist[AFI_MAX][ZEBRA_ROUTE_MAX]; | |
718e3744 | 67 | |
68 | /* Redistribute default route flag. */ | |
7076bb2f | 69 | vrf_bitmap_t redist_default; |
718e3744 | 70 | |
71 | /* Interface information. */ | |
7076bb2f | 72 | vrf_bitmap_t ifinfo; |
18a6dce6 | 73 | |
74 | /* Router-id information. */ | |
7076bb2f | 75 | vrf_bitmap_t ridinfo; |
fb018d25 DS |
76 | |
77 | /* client's protocol */ | |
78 | u_char proto; | |
7c8ff89e | 79 | u_short instance; |
04b02fda DS |
80 | |
81 | /* Statistics */ | |
82 | u_int32_t redist_v4_add_cnt; | |
83 | u_int32_t redist_v4_del_cnt; | |
84 | u_int32_t redist_v6_add_cnt; | |
85 | u_int32_t redist_v6_del_cnt; | |
86 | u_int32_t v4_route_add_cnt; | |
87 | u_int32_t v4_route_upd8_cnt; | |
88 | u_int32_t v4_route_del_cnt; | |
89 | u_int32_t v6_route_add_cnt; | |
90 | u_int32_t v6_route_del_cnt; | |
91 | u_int32_t v6_route_upd8_cnt; | |
92 | u_int32_t connected_rt_add_cnt; | |
93 | u_int32_t connected_rt_del_cnt; | |
94 | u_int32_t ifup_cnt; | |
95 | u_int32_t ifdown_cnt; | |
96 | u_int32_t ifadd_cnt; | |
97 | u_int32_t ifdel_cnt; | |
d5a5c8f0 | 98 | u_int32_t if_bfd_cnt; |
c43ed2e4 DS |
99 | u_int32_t bfd_peer_add_cnt; |
100 | u_int32_t bfd_peer_upd8_cnt; | |
101 | u_int32_t bfd_peer_del_cnt; | |
102 | u_int32_t bfd_peer_replay_cnt; | |
12f6fb97 DS |
103 | u_int32_t vrfadd_cnt; |
104 | u_int32_t vrfdel_cnt; | |
04b02fda DS |
105 | |
106 | time_t connect_time; | |
107 | time_t last_read_time; | |
108 | time_t last_write_time; | |
109 | time_t nh_reg_time; | |
110 | time_t nh_dereg_time; | |
111 | time_t nh_last_upd_time; | |
112 | ||
113 | int last_read_cmd; | |
114 | int last_write_cmd; | |
718e3744 | 115 | }; |
116 | ||
b21b19c5 | 117 | /* Zebra instance */ |
118 | struct zebra_t | |
119 | { | |
120 | /* Thread master */ | |
121 | struct thread_master *master; | |
52dc7ee6 | 122 | struct list *client_list; |
b21b19c5 | 123 | |
124 | /* default table */ | |
4e3afb14 | 125 | u_int32_t rtm_table_default; |
4d38fdb4 | 126 | |
127 | /* rib work queue */ | |
128 | struct work_queue *ribq; | |
e96f9203 | 129 | struct meta_queue *mq; |
b21b19c5 | 130 | }; |
131 | ||
718e3744 | 132 | /* Prototypes. */ |
a1ac18c4 | 133 | extern void zebra_init (void); |
134 | extern void zebra_if_init (void); | |
b5114685 | 135 | extern void zebra_zserv_socket_init (char *path); |
a1ac18c4 | 136 | extern void hostinfo_get (void); |
137 | extern void rib_init (void); | |
12f6fb97 DS |
138 | extern void interface_list (struct zebra_ns *); |
139 | extern void route_read (struct zebra_ns *); | |
140 | extern void kernel_init (struct zebra_ns *); | |
141 | extern void kernel_terminate (struct zebra_ns *); | |
7514fb77 | 142 | extern void zebra_route_map_init (void); |
a1ac18c4 | 143 | extern void zebra_snmp_init (void); |
144 | extern void zebra_vty_init (void); | |
145 | ||
12f6fb97 DS |
146 | extern int zsend_vrf_add (struct zserv *, struct vrf *); |
147 | extern int zsend_vrf_delete (struct zserv *, struct vrf *); | |
148 | ||
a1ac18c4 | 149 | extern int zsend_interface_add (struct zserv *, struct interface *); |
a1ac18c4 | 150 | extern int zsend_interface_delete (struct zserv *, struct interface *); |
a1ac18c4 | 151 | extern int zsend_interface_address (int, struct zserv *, struct interface *, |
152 | struct connected *); | |
a80beece DS |
153 | extern void nbr_connected_replacement_add_ipv6 (struct interface *, |
154 | struct in6_addr *, u_char); | |
155 | extern void nbr_connected_delete_ipv6 (struct interface *, struct in6_addr *, u_char); | |
a1ac18c4 | 156 | extern int zsend_interface_update (int, struct zserv *, struct interface *); |
5048fe14 | 157 | extern int zsend_redistribute_route (int, struct zserv *, struct prefix *, |
158 | struct rib *); | |
c6ffe645 FL |
159 | extern int zsend_router_id_update (struct zserv *, struct prefix *, |
160 | vrf_id_t); | |
161 | ||
718e3744 | 162 | extern pid_t pid; |
718e3744 | 163 | |
7076bb2f | 164 | extern void zserv_create_header(struct stream *s, uint16_t cmd, vrf_id_t vrf_id); |
6878b9db | 165 | extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const u_char); |
fb018d25 DS |
166 | extern int zebra_server_send_message(struct zserv *client); |
167 | ||
518f0eb1 DS |
168 | extern void zebra_route_map_write_delay_timer(struct vty *); |
169 | extern route_map_result_t zebra_route_map_check (int family, int rib_type, | |
170 | struct prefix *p, | |
ca84c8ef | 171 | struct nexthop *nexthop, |
0032dd59 | 172 | vrf_id_t vrf_id, |
ca84c8ef | 173 | u_short tag); |
9f0ea7d4 DS |
174 | extern route_map_result_t zebra_nht_route_map_check (int family, |
175 | int client_proto, | |
176 | struct prefix *p, | |
177 | struct rib *, | |
178 | struct nexthop *nexthop); | |
518f0eb1 | 179 | |
718e3744 | 180 | #endif /* _ZEBRA_ZEBRA_H */ |