blob: 3d7ebbcd85da9b1ee885cc486c4853b3b692775e [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"
paul5b73a672004-07-23 15:26:14 +000028
paul718e3742002-12-13 20:15:29 +000029/* Default port information. */
paul718e3742002-12-13 20:15:29 +000030#define ZEBRA_VTY_PORT 2601
paul718e3742002-12-13 20:15:29 +000031
32/* Default configuration filename. */
33#define DEFAULT_CONFIG_FILE "zebra.conf"
34
35/* Client structure. */
36struct zserv
37{
38 /* Client file descriptor. */
39 int sock;
40
Josh Baileyaf56d402012-03-21 18:47:51 -070041 /* Client route type. */
42 /* Assuming each client contains only one type of route. */
43 int route_type;
44
paul718e3742002-12-13 20:15:29 +000045 /* Input/output buffer to the client. */
46 struct stream *ibuf;
47 struct stream *obuf;
48
ajs719e9742005-02-28 20:52:15 +000049 /* Buffer of data waiting to be written to client. */
50 struct buffer *wb;
51
paul718e3742002-12-13 20:15:29 +000052 /* Threads for read/write. */
53 struct thread *t_read;
54 struct thread *t_write;
55
ajs719e9742005-02-28 20:52:15 +000056 /* Thread for delayed close. */
57 struct thread *t_suicide;
58
paul718e3742002-12-13 20:15:29 +000059 /* default routing table this client munges */
60 int rtm_table;
61
62 /* This client's redistribute flag. */
63 u_char redist[ZEBRA_ROUTE_MAX];
64
65 /* Redistribute default route flag. */
66 u_char redist_default;
67
68 /* Interface information. */
69 u_char ifinfo;
hasso18a6dce2004-10-03 18:18:34 +000070
71 /* Router-id information. */
72 u_char ridinfo;
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/* Count prefix size from mask length */
91#define PSIZE(a) (((a) + 7) / (8))
92
93/* Prototypes. */
paula1ac18c2005-06-28 17:17:12 +000094extern void zebra_init (void);
95extern void zebra_if_init (void);
Vyacheslav Trushkinb5114682011-11-25 18:51:48 +040096extern void zebra_zserv_socket_init (char *path);
paula1ac18c2005-06-28 17:17:12 +000097extern void hostinfo_get (void);
98extern void rib_init (void);
99extern void interface_list (void);
100extern void kernel_init (void);
101extern void route_read (void);
Paul Jakma7514fb72007-05-02 16:05:35 +0000102extern void zebra_route_map_init (void);
paula1ac18c2005-06-28 17:17:12 +0000103extern void zebra_snmp_init (void);
104extern void zebra_vty_init (void);
paul718e3742002-12-13 20:15:29 +0000105
paula1ac18c2005-06-28 17:17:12 +0000106extern int zsend_interface_add (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000107extern int zsend_interface_delete (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000108extern int zsend_interface_address (int, struct zserv *, struct interface *,
109 struct connected *);
110extern int zsend_interface_update (int, struct zserv *, struct interface *);
111extern int zsend_route_multipath (int, struct zserv *, struct prefix *,
112 struct rib *);
113extern int zsend_router_id_update(struct zserv *, struct prefix *);
paul718e3742002-12-13 20:15:29 +0000114
115extern pid_t pid;
paul718e3742002-12-13 20:15:29 +0000116
117#endif /* _ZEBRA_ZEBRA_H */