jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isis_circuit.h |
| 3 | * |
| 4 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 5 | * Tampere University of Technology |
| 6 | * Institute of Communications Engineering |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public Licenseas published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 16 | * more details. |
| 17 | |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #ifndef ISIS_CIRCUIT_H |
| 24 | #define ISIS_CIRCUIT_H |
| 25 | |
David Lamparter | 388f885 | 2015-03-03 08:55:54 +0100 | [diff] [blame] | 26 | #include "vty.h" |
| 27 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 28 | #define CIRCUIT_MAX 255 |
| 29 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 30 | struct password |
| 31 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 32 | struct password *next; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 33 | int len; |
| 34 | u_char *pass; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 37 | struct metric |
| 38 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 39 | u_char metric_default; |
| 40 | u_char metric_error; |
| 41 | u_char metric_expense; |
| 42 | u_char metric_delay; |
| 43 | }; |
| 44 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 45 | struct isis_bcast_info |
| 46 | { |
| 47 | u_char snpa[ETH_ALEN]; /* SNPA of this circuit */ |
| 48 | char run_dr_elect[2]; /* Should we run dr election ? */ |
| 49 | struct thread *t_run_dr[2]; /* DR election thread */ |
| 50 | struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */ |
| 51 | struct list *adjdb[2]; /* adjacency dbs */ |
| 52 | struct list *lan_neighs[2]; /* list of lx neigh snpa */ |
| 53 | char is_dr[2]; /* Are we level x DR ? */ |
| 54 | u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ |
| 55 | u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */ |
| 56 | struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 57 | }; |
| 58 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 59 | struct isis_p2p_info |
| 60 | { |
| 61 | struct isis_adjacency *neighbor; |
| 62 | struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 65 | struct isis_circuit |
| 66 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 67 | int state; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 68 | u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */ |
| 69 | struct isis_area *area; /* back pointer to the area */ |
| 70 | struct interface *interface; /* interface info from z */ |
| 71 | int fd; /* IS-IS l1/2 socket */ |
Paul Jakma | 238497f | 2007-08-07 18:49:18 +0000 | [diff] [blame] | 72 | int sap_length; /* SAP length for DLPI */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 73 | struct nlpids nlpids; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 74 | /* |
| 75 | * Threads |
| 76 | */ |
| 77 | struct thread *t_read; |
| 78 | struct thread *t_send_csnp[2]; |
| 79 | struct thread *t_send_psnp[2]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 80 | struct list *lsp_queue; /* LSPs to be txed (both levels) */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 81 | time_t lsp_queue_last_cleared;/* timestamp used to enforce transmit interval; |
| 82 | * for scalability, use one timestamp per |
| 83 | * circuit, instead of one per lsp per circuit |
| 84 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 85 | /* there is no real point in two streams, just for programming kicker */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 86 | int (*rx) (struct isis_circuit * circuit, u_char * ssnpa); |
| 87 | struct stream *rcv_stream; /* Stream for receiving */ |
| 88 | int (*tx) (struct isis_circuit * circuit, int level); |
| 89 | struct stream *snd_stream; /* Stream for sending */ |
| 90 | int idx; /* idx in S[RM|SN] flags */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 91 | #define CIRCUIT_T_UNKNOWN 0 |
| 92 | #define CIRCUIT_T_BROADCAST 1 |
| 93 | #define CIRCUIT_T_P2P 2 |
| 94 | #define CIRCUIT_T_LOOPBACK 3 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 95 | int circ_type; /* type of the physical interface */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 96 | int circ_type_config; /* config type of the physical interface */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 97 | union |
| 98 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 99 | struct isis_bcast_info bc; |
| 100 | struct isis_p2p_info p2p; |
| 101 | } u; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 102 | u_char priority[2]; /* l1/2 IS configured priority */ |
| 103 | int pad_hellos; /* add padding to Hello PDUs ? */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 104 | char ext_domain; /* externalDomain (boolean) */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 105 | int lsp_regenerate_pending[ISIS_LEVELS]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 106 | /* |
| 107 | * Configurables |
| 108 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 109 | struct isis_passwd passwd; /* Circuit rx/tx password */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 110 | int is_type; /* circuit is type == level of circuit |
Olivier Dugeon | 4f59357 | 2016-04-19 19:03:05 +0200 | [diff] [blame] | 111 | * differentiated from circuit type (media) */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 112 | u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */ |
| 113 | u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */ |
| 114 | u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ |
| 115 | u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ |
| 116 | struct metric metrics[2]; /* l1XxxMetric */ |
hasso | f21fb27 | 2005-09-26 17:05:55 +0000 | [diff] [blame] | 117 | u_int32_t te_metric[2]; |
Olivier Dugeon | 4f59357 | 2016-04-19 19:03:05 +0200 | [diff] [blame] | 118 | struct mpls_te_circuit *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 119 | int ip_router; /* Route IP ? */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 120 | int is_passive; /* Is Passive ? */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 121 | struct list *ip_addrs; /* our IP addresses */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 122 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 123 | int ipv6_router; /* Route IPv6 ? */ |
| 124 | struct list *ipv6_link; /* our link local IPv6 addresses */ |
| 125 | struct list *ipv6_non_link; /* our non-link local IPv6 addresses */ |
| 126 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 127 | u_int16_t upadjcount[2]; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 128 | #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01 |
| 129 | u_char flags; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 130 | /* |
| 131 | * Counters as in 10589--11.2.5.9 |
| 132 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 133 | u_int32_t adj_state_changes; /* changesInAdjacencyState */ |
| 134 | u_int32_t init_failures; /* intialisationFailures */ |
| 135 | u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */ |
| 136 | u_int32_t ctrl_pdus_txed; /* controlPDUsSent */ |
| 137 | u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */ |
| 138 | u_int32_t rej_adjacencies; /* rejectedAdjacencies */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 141 | void isis_circuit_init (void); |
| 142 | struct isis_circuit *isis_circuit_new (void); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 143 | void isis_circuit_del (struct isis_circuit *circuit); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 144 | struct isis_circuit *circuit_lookup_by_ifp (struct interface *ifp, |
| 145 | struct list *list); |
| 146 | struct isis_circuit *circuit_scan_by_ifp (struct interface *ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 147 | void isis_circuit_configure (struct isis_circuit *circuit, |
| 148 | struct isis_area *area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 149 | void isis_circuit_deconfigure (struct isis_circuit *circuit, |
| 150 | struct isis_area *area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 151 | void isis_circuit_if_add (struct isis_circuit *circuit, |
| 152 | struct interface *ifp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 153 | void isis_circuit_if_del (struct isis_circuit *circuit, |
| 154 | struct interface *ifp); |
| 155 | void isis_circuit_if_bind (struct isis_circuit *circuit, |
| 156 | struct interface *ifp); |
| 157 | void isis_circuit_if_unbind (struct isis_circuit *circuit, |
| 158 | struct interface *ifp); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 159 | void isis_circuit_add_addr (struct isis_circuit *circuit, |
| 160 | struct connected *conn); |
| 161 | void isis_circuit_del_addr (struct isis_circuit *circuit, |
| 162 | struct connected *conn); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 163 | int isis_circuit_up (struct isis_circuit *circuit); |
| 164 | void isis_circuit_down (struct isis_circuit *); |
| 165 | void circuit_update_nlpids (struct isis_circuit *circuit); |
| 166 | void isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty, |
| 167 | char detail); |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 168 | size_t isis_circuit_pdu_size(struct isis_circuit *circuit); |
| 169 | void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 170 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 171 | #endif /* _ZEBRA_ISIS_CIRCUIT_H */ |