paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 25 | #include "rib.h" |
paul | ec1a428 | 2005-11-24 15:15:17 +0000 | [diff] [blame] | 26 | #include "if.h" |
paul | 4d38fdb | 2005-04-28 17:35:14 +0000 | [diff] [blame] | 27 | #include "workqueue.h" |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 28 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 29 | /* Default port information. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 30 | #define ZEBRA_VTY_PORT 2601 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 31 | |
| 32 | /* Default configuration filename. */ |
| 33 | #define DEFAULT_CONFIG_FILE "zebra.conf" |
| 34 | |
| 35 | /* Client structure. */ |
| 36 | struct 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 | |
ajs | 719e974 | 2005-02-28 20:52:15 +0000 | [diff] [blame] | 45 | /* Buffer of data waiting to be written to client. */ |
| 46 | struct buffer *wb; |
| 47 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 48 | /* Threads for read/write. */ |
| 49 | struct thread *t_read; |
| 50 | struct thread *t_write; |
| 51 | |
ajs | 719e974 | 2005-02-28 20:52:15 +0000 | [diff] [blame] | 52 | /* Thread for delayed close. */ |
| 53 | struct thread *t_suicide; |
| 54 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 55 | /* 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; |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 66 | |
| 67 | /* Router-id information. */ |
| 68 | u_char ridinfo; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 71 | /* Zebra instance */ |
| 72 | struct zebra_t |
| 73 | { |
| 74 | /* Thread master */ |
| 75 | struct thread_master *master; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 76 | struct list *client_list; |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 77 | |
| 78 | /* default table */ |
| 79 | int rtm_table_default; |
paul | 4d38fdb | 2005-04-28 17:35:14 +0000 | [diff] [blame] | 80 | |
| 81 | /* rib work queue */ |
| 82 | struct work_queue *ribq; |
Denis Ovsienko | e96f920 | 2008-06-02 12:03:22 +0000 | [diff] [blame] | 83 | struct meta_queue *mq; |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 84 | }; |
| 85 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 86 | /* Count prefix size from mask length */ |
| 87 | #define PSIZE(a) (((a) + 7) / (8)) |
| 88 | |
| 89 | /* Prototypes. */ |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 90 | extern void zebra_init (void); |
| 91 | extern void zebra_if_init (void); |
Vyacheslav Trushkin | b511468 | 2011-11-25 18:51:48 +0400 | [diff] [blame] | 92 | extern void zebra_zserv_socket_init (char *path); |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 93 | extern void hostinfo_get (void); |
| 94 | extern void rib_init (void); |
| 95 | extern void interface_list (void); |
| 96 | extern void kernel_init (void); |
| 97 | extern void route_read (void); |
Paul Jakma | 7514fb7 | 2007-05-02 16:05:35 +0000 | [diff] [blame] | 98 | extern void zebra_route_map_init (void); |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 99 | extern void zebra_snmp_init (void); |
| 100 | extern void zebra_vty_init (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 101 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 102 | extern int zsend_interface_add (struct zserv *, struct interface *); |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 103 | extern int zsend_interface_delete (struct zserv *, struct interface *); |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 104 | extern int zsend_interface_address (int, struct zserv *, struct interface *, |
| 105 | struct connected *); |
| 106 | extern int zsend_interface_update (int, struct zserv *, struct interface *); |
| 107 | extern int zsend_route_multipath (int, struct zserv *, struct prefix *, |
| 108 | struct rib *); |
| 109 | extern int zsend_router_id_update(struct zserv *, struct prefix *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 110 | |
| 111 | extern pid_t pid; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 112 | |
| 113 | #endif /* _ZEBRA_ZEBRA_H */ |