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