]>
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" |
7c8ff89e | 29 | #include "zclient.h" |
5b73a671 | 30 | |
718e3744 | 31 | /* Default port information. */ |
718e3744 | 32 | #define ZEBRA_VTY_PORT 2601 |
718e3744 | 33 | |
34 | /* Default configuration filename. */ | |
35 | #define DEFAULT_CONFIG_FILE "zebra.conf" | |
36 | ||
518f0eb1 DS |
37 | #define ZEBRA_RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ |
38 | ||
718e3744 | 39 | /* Client structure. */ |
40 | struct zserv | |
41 | { | |
42 | /* Client file descriptor. */ | |
43 | int sock; | |
44 | ||
45 | /* Input/output buffer to the client. */ | |
46 | struct stream *ibuf; | |
47 | struct stream *obuf; | |
48 | ||
719e9741 | 49 | /* Buffer of data waiting to be written to client. */ |
50 | struct buffer *wb; | |
51 | ||
718e3744 | 52 | /* Threads for read/write. */ |
53 | struct thread *t_read; | |
54 | struct thread *t_write; | |
55 | ||
719e9741 | 56 | /* Thread for delayed close. */ |
57 | struct thread *t_suicide; | |
58 | ||
718e3744 | 59 | /* default routing table this client munges */ |
60 | int rtm_table; | |
61 | ||
62 | /* This client's redistribute flag. */ | |
7c8ff89e | 63 | struct redist_proto redist[ZEBRA_ROUTE_MAX]; |
718e3744 | 64 | |
65 | /* Redistribute default route flag. */ | |
66 | u_char redist_default; | |
67 | ||
68 | /* Interface information. */ | |
69 | u_char ifinfo; | |
18a6dce6 | 70 | |
71 | /* Router-id information. */ | |
72 | u_char ridinfo; | |
fb018d25 DS |
73 | |
74 | /* client's protocol */ | |
75 | u_char proto; | |
7c8ff89e | 76 | u_short instance; |
04b02fda DS |
77 | |
78 | /* Statistics */ | |
79 | u_int32_t redist_v4_add_cnt; | |
80 | u_int32_t redist_v4_del_cnt; | |
81 | u_int32_t redist_v6_add_cnt; | |
82 | u_int32_t redist_v6_del_cnt; | |
83 | u_int32_t v4_route_add_cnt; | |
84 | u_int32_t v4_route_upd8_cnt; | |
85 | u_int32_t v4_route_del_cnt; | |
86 | u_int32_t v6_route_add_cnt; | |
87 | u_int32_t v6_route_del_cnt; | |
88 | u_int32_t v6_route_upd8_cnt; | |
89 | u_int32_t connected_rt_add_cnt; | |
90 | u_int32_t connected_rt_del_cnt; | |
91 | u_int32_t ifup_cnt; | |
92 | u_int32_t ifdown_cnt; | |
93 | u_int32_t ifadd_cnt; | |
94 | u_int32_t ifdel_cnt; | |
d5a5c8f0 | 95 | u_int32_t if_bfd_cnt; |
04b02fda DS |
96 | |
97 | time_t connect_time; | |
98 | time_t last_read_time; | |
99 | time_t last_write_time; | |
100 | time_t nh_reg_time; | |
101 | time_t nh_dereg_time; | |
102 | time_t nh_last_upd_time; | |
103 | ||
104 | int last_read_cmd; | |
105 | int last_write_cmd; | |
718e3744 | 106 | }; |
107 | ||
b21b19c5 | 108 | /* Zebra instance */ |
109 | struct zebra_t | |
110 | { | |
111 | /* Thread master */ | |
112 | struct thread_master *master; | |
52dc7ee6 | 113 | struct list *client_list; |
b21b19c5 | 114 | |
115 | /* default table */ | |
116 | int rtm_table_default; | |
4d38fdb4 | 117 | |
118 | /* rib work queue */ | |
119 | struct work_queue *ribq; | |
e96f9203 | 120 | struct meta_queue *mq; |
b21b19c5 | 121 | }; |
122 | ||
718e3744 | 123 | /* Count prefix size from mask length */ |
124 | #define PSIZE(a) (((a) + 7) / (8)) | |
125 | ||
126 | /* Prototypes. */ | |
a1ac18c4 | 127 | extern void zebra_init (void); |
128 | extern void zebra_if_init (void); | |
b5114685 | 129 | extern void zebra_zserv_socket_init (char *path); |
a1ac18c4 | 130 | extern void hostinfo_get (void); |
131 | extern void rib_init (void); | |
132 | extern void interface_list (void); | |
133 | extern void kernel_init (void); | |
134 | extern void route_read (void); | |
7514fb77 | 135 | extern void zebra_route_map_init (void); |
a1ac18c4 | 136 | extern void zebra_snmp_init (void); |
137 | extern void zebra_vty_init (void); | |
138 | ||
139 | extern int zsend_interface_add (struct zserv *, struct interface *); | |
a1ac18c4 | 140 | extern int zsend_interface_delete (struct zserv *, struct interface *); |
a1ac18c4 | 141 | extern int zsend_interface_address (int, struct zserv *, struct interface *, |
142 | struct connected *); | |
a80beece DS |
143 | extern void nbr_connected_replacement_add_ipv6 (struct interface *, |
144 | struct in6_addr *, u_char); | |
145 | extern void nbr_connected_delete_ipv6 (struct interface *, struct in6_addr *, u_char); | |
a1ac18c4 | 146 | extern int zsend_interface_update (int, struct zserv *, struct interface *); |
147 | extern int zsend_route_multipath (int, struct zserv *, struct prefix *, | |
148 | struct rib *); | |
149 | extern int zsend_router_id_update(struct zserv *, struct prefix *); | |
d5a5c8f0 DS |
150 | extern int zsend_interface_bfd_update(int, struct zserv *, struct interface *, |
151 | struct prefix *); | |
718e3744 | 152 | extern pid_t pid; |
718e3744 | 153 | |
fb018d25 DS |
154 | extern void zserv_create_header(struct stream *s, uint16_t cmd); |
155 | extern int zebra_server_send_message(struct zserv *client); | |
156 | ||
518f0eb1 DS |
157 | extern void zebra_route_map_write_delay_timer(struct vty *); |
158 | extern route_map_result_t zebra_route_map_check (int family, int rib_type, | |
159 | struct prefix *p, | |
160 | struct nexthop *nexthop); | |
9f0ea7d4 DS |
161 | extern route_map_result_t zebra_nht_route_map_check (int family, |
162 | int client_proto, | |
163 | struct prefix *p, | |
164 | struct rib *, | |
165 | struct nexthop *nexthop); | |
518f0eb1 | 166 | |
718e3744 | 167 | #endif /* _ZEBRA_ZEBRA_H */ |