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