blob: 7a2b4a1d19f933ab756283cbd020cd162d00e14b [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* 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
paul5b73a672004-07-23 15:26:14 +000025#include "rib.h"
paulec1a4282005-11-24 15:15:17 +000026#include "if.h"
paul4d38fdb2005-04-28 17:35:14 +000027#include "workqueue.h"
Feng Luc99f3482014-10-16 09:52:36 +080028#include "vrf.h"
paul5b73a672004-07-23 15:26:14 +000029
paul718e3742002-12-13 20:15:29 +000030/* Default port information. */
paul718e3742002-12-13 20:15:29 +000031#define ZEBRA_VTY_PORT 2601
paul718e3742002-12-13 20:15:29 +000032
33/* Default configuration filename. */
34#define DEFAULT_CONFIG_FILE "zebra.conf"
35
36/* Client structure. */
37struct zserv
38{
39 /* Client file descriptor. */
40 int sock;
41
42 /* Input/output buffer to the client. */
43 struct stream *ibuf;
44 struct stream *obuf;
45
ajs719e9742005-02-28 20:52:15 +000046 /* Buffer of data waiting to be written to client. */
47 struct buffer *wb;
48
paul718e3742002-12-13 20:15:29 +000049 /* Threads for read/write. */
50 struct thread *t_read;
51 struct thread *t_write;
52
ajs719e9742005-02-28 20:52:15 +000053 /* Thread for delayed close. */
54 struct thread *t_suicide;
55
paul718e3742002-12-13 20:15:29 +000056 /* default routing table this client munges */
57 int rtm_table;
58
59 /* This client's redistribute flag. */
Feng Luc99f3482014-10-16 09:52:36 +080060 vrf_bitmap_t redist[ZEBRA_ROUTE_MAX];
paul718e3742002-12-13 20:15:29 +000061
62 /* Redistribute default route flag. */
Feng Luc99f3482014-10-16 09:52:36 +080063 vrf_bitmap_t redist_default;
paul718e3742002-12-13 20:15:29 +000064
65 /* Interface information. */
Feng Luc99f3482014-10-16 09:52:36 +080066 vrf_bitmap_t ifinfo;
hasso18a6dce2004-10-03 18:18:34 +000067
68 /* Router-id information. */
Feng Luc99f3482014-10-16 09:52:36 +080069 vrf_bitmap_t ridinfo;
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -050070
71 /* client's protocol */
72 u_char proto;
paul718e3742002-12-13 20:15:29 +000073};
74
paulb21b19c2003-06-15 01:28:29 +000075/* Zebra instance */
76struct zebra_t
77{
78 /* Thread master */
79 struct thread_master *master;
hasso52dc7ee2004-09-23 19:18:23 +000080 struct list *client_list;
paulb21b19c2003-06-15 01:28:29 +000081
82 /* default table */
83 int rtm_table_default;
paul4d38fdb2005-04-28 17:35:14 +000084
85 /* rib work queue */
86 struct work_queue *ribq;
Denis Ovsienkoe96f9202008-06-02 12:03:22 +000087 struct meta_queue *mq;
paulb21b19c2003-06-15 01:28:29 +000088};
89
paul718e3742002-12-13 20:15:29 +000090/* Prototypes. */
paula1ac18c2005-06-28 17:17:12 +000091extern void zebra_init (void);
92extern void zebra_if_init (void);
Vyacheslav Trushkinb5114682011-11-25 18:51:48 +040093extern void zebra_zserv_socket_init (char *path);
paula1ac18c2005-06-28 17:17:12 +000094extern void hostinfo_get (void);
95extern void rib_init (void);
Feng Lu758fb8f2014-07-03 18:23:09 +080096extern void interface_list (struct zebra_vrf *);
97extern void route_read (struct zebra_vrf *);
98extern void kernel_init (struct zebra_vrf *);
99extern void kernel_terminate (struct zebra_vrf *);
Paul Jakma7514fb72007-05-02 16:05:35 +0000100extern void zebra_route_map_init (void);
paula1ac18c2005-06-28 17:17:12 +0000101extern void zebra_snmp_init (void);
102extern void zebra_vty_init (void);
paul718e3742002-12-13 20:15:29 +0000103
paula1ac18c2005-06-28 17:17:12 +0000104extern int zsend_interface_add (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000105extern int zsend_interface_delete (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000106extern int zsend_interface_address (int, struct zserv *, struct interface *,
107 struct connected *);
108extern int zsend_interface_update (int, struct zserv *, struct interface *);
109extern int zsend_route_multipath (int, struct zserv *, struct prefix *,
110 struct rib *);
Feng Luac19a442015-05-22 11:40:07 +0200111extern int zsend_router_id_update (struct zserv *, struct prefix *,
112 vrf_id_t);
paul718e3742002-12-13 20:15:29 +0000113
Olivier Dugeon15773a82016-04-19 18:29:55 +0200114extern int zsend_interface_link_params (struct zserv *, struct interface *);
115
paul718e3742002-12-13 20:15:29 +0000116extern pid_t pid;
paul718e3742002-12-13 20:15:29 +0000117
Pradosh Mohapatra60cc9592015-11-09 20:21:41 -0500118extern void zserv_create_header(struct stream *s, uint16_t cmd, vrf_id_t);
119extern int zebra_server_send_message(struct zserv *client);
120
paul718e3742002-12-13 20:15:29 +0000121#endif /* _ZEBRA_ZEBRA_H */