blob: 9a570fb3bea19ef8e8587e490576a7256c0b879d [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
41 /* Input/output buffer to the client. */
42 struct stream *ibuf;
43 struct stream *obuf;
44
ajs719e9742005-02-28 20:52:15 +000045 /* Buffer of data waiting to be written to client. */
46 struct buffer *wb;
47
paul718e3742002-12-13 20:15:29 +000048 /* Threads for read/write. */
49 struct thread *t_read;
50 struct thread *t_write;
51
ajs719e9742005-02-28 20:52:15 +000052 /* Thread for delayed close. */
53 struct thread *t_suicide;
54
paul718e3742002-12-13 20:15:29 +000055 /* default routing table this client munges */
56 int rtm_table;
57
58 /* This client's redistribute flag. */
59 u_char redist[ZEBRA_ROUTE_MAX];
60
61 /* Redistribute default route flag. */
62 u_char redist_default;
63
64 /* Interface information. */
65 u_char ifinfo;
hasso18a6dce2004-10-03 18:18:34 +000066
67 /* Router-id information. */
68 u_char ridinfo;
paul718e3742002-12-13 20:15:29 +000069};
70
paulb21b19c2003-06-15 01:28:29 +000071/* Zebra instance */
72struct zebra_t
73{
74 /* Thread master */
75 struct thread_master *master;
hasso52dc7ee2004-09-23 19:18:23 +000076 struct list *client_list;
paulb21b19c2003-06-15 01:28:29 +000077
78 /* default table */
79 int rtm_table_default;
paul4d38fdb2005-04-28 17:35:14 +000080
81 /* rib work queue */
82 struct work_queue *ribq;
paulb21b19c2003-06-15 01:28:29 +000083};
84
paul718e3742002-12-13 20:15:29 +000085/* Count prefix size from mask length */
86#define PSIZE(a) (((a) + 7) / (8))
87
88/* Prototypes. */
paula1ac18c2005-06-28 17:17:12 +000089extern void zebra_init (void);
90extern void zebra_if_init (void);
91extern void hostinfo_get (void);
92extern void rib_init (void);
93extern void interface_list (void);
94extern void kernel_init (void);
95extern void route_read (void);
96extern void zebra_snmp_init (void);
97extern void zebra_vty_init (void);
paul718e3742002-12-13 20:15:29 +000098
paula1ac18c2005-06-28 17:17:12 +000099extern int zsend_interface_add (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000100extern int zsend_interface_delete (struct zserv *, struct interface *);
paula1ac18c2005-06-28 17:17:12 +0000101extern int zsend_interface_address (int, struct zserv *, struct interface *,
102 struct connected *);
103extern int zsend_interface_update (int, struct zserv *, struct interface *);
104extern int zsend_route_multipath (int, struct zserv *, struct prefix *,
105 struct rib *);
106extern int zsend_router_id_update(struct zserv *, struct prefix *);
paul718e3742002-12-13 20:15:29 +0000107
108extern pid_t pid;
109extern pid_t old_pid;
110
111#endif /* _ZEBRA_ZEBRA_H */