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 | 4d38fdb | 2005-04-28 17:35:14 +0000 | [diff] [blame] | 26 | #include "workqueue.h" |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 27 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 28 | /* Default port information. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 29 | #define ZEBRA_VTY_PORT 2601 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 30 | |
| 31 | /* Default configuration filename. */ |
| 32 | #define DEFAULT_CONFIG_FILE "zebra.conf" |
| 33 | |
| 34 | /* Client structure. */ |
| 35 | struct zserv |
| 36 | { |
| 37 | /* Client file descriptor. */ |
| 38 | int sock; |
| 39 | |
| 40 | /* Input/output buffer to the client. */ |
| 41 | struct stream *ibuf; |
| 42 | struct stream *obuf; |
| 43 | |
ajs | 719e974 | 2005-02-28 20:52:15 +0000 | [diff] [blame] | 44 | /* Buffer of data waiting to be written to client. */ |
| 45 | struct buffer *wb; |
| 46 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 47 | /* Threads for read/write. */ |
| 48 | struct thread *t_read; |
| 49 | struct thread *t_write; |
| 50 | |
ajs | 719e974 | 2005-02-28 20:52:15 +0000 | [diff] [blame] | 51 | /* Thread for delayed close. */ |
| 52 | struct thread *t_suicide; |
| 53 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | /* default routing table this client munges */ |
| 55 | int rtm_table; |
| 56 | |
| 57 | /* This client's redistribute flag. */ |
| 58 | u_char redist[ZEBRA_ROUTE_MAX]; |
| 59 | |
| 60 | /* Redistribute default route flag. */ |
| 61 | u_char redist_default; |
| 62 | |
| 63 | /* Interface information. */ |
| 64 | u_char ifinfo; |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 65 | |
| 66 | /* Router-id information. */ |
| 67 | u_char ridinfo; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 70 | /* Zebra instance */ |
| 71 | struct zebra_t |
| 72 | { |
| 73 | /* Thread master */ |
| 74 | struct thread_master *master; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 75 | struct list *client_list; |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 76 | |
| 77 | /* default table */ |
| 78 | int rtm_table_default; |
paul | 4d38fdb | 2005-04-28 17:35:14 +0000 | [diff] [blame] | 79 | |
| 80 | /* rib work queue */ |
| 81 | struct work_queue *ribq; |
paul | b21b19c | 2003-06-15 01:28:29 +0000 | [diff] [blame] | 82 | }; |
| 83 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 84 | /* Count prefix size from mask length */ |
| 85 | #define PSIZE(a) (((a) + 7) / (8)) |
| 86 | |
| 87 | /* Prototypes. */ |
| 88 | void zebra_init (); |
| 89 | void zebra_if_init (); |
| 90 | void hostinfo_get (); |
| 91 | void rib_init (); |
| 92 | void interface_list (); |
| 93 | void kernel_init (); |
| 94 | void route_read (); |
| 95 | void rtadv_init (); |
| 96 | void zebra_snmp_init (); |
| 97 | |
paul | b9df2d2 | 2004-05-09 09:09:59 +0000 | [diff] [blame] | 98 | int zsend_interface_add (struct zserv *, struct interface *); |
| 99 | #if (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK)) |
| 100 | int zsend_interface_delete (struct zserv *, struct interface *); |
hasso | 726f9b2 | 2003-05-25 21:04:54 +0000 | [diff] [blame] | 101 | #endif |
paul | b9df2d2 | 2004-05-09 09:09:59 +0000 | [diff] [blame] | 102 | int zsend_interface_address (int, struct zserv *, struct interface *, |
| 103 | struct connected *); |
| 104 | int zsend_interface_update (int, struct zserv *, struct interface *); |
| 105 | int zsend_route_multipath (int, struct zserv *, struct prefix *, struct rib *); |
hasso | 18a6dce | 2004-10-03 18:18:34 +0000 | [diff] [blame] | 106 | int zsend_router_id_update(struct zserv *, struct prefix *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 107 | |
| 108 | extern pid_t pid; |
| 109 | extern pid_t old_pid; |
| 110 | |
| 111 | #endif /* _ZEBRA_ZEBRA_H */ |