blob: 343b492f3dcdabfc899fc550487c9ae800f7dc01 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
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 Lamparter388f8852015-03-03 08:55:54 +010026#include "vty.h"
David Lamparter3732cba2016-07-29 16:19:40 +020027#include "if.h"
28
29#include "isis_constants.h"
30#include "isis_common.h"
David Lamparter388f8852015-03-03 08:55:54 +010031
jardineb5d44e2003-12-23 08:09:43 +000032#define CIRCUIT_MAX 255
33
hassof390d2c2004-09-10 20:48:21 +000034struct password
35{
jardineb5d44e2003-12-23 08:09:43 +000036 struct password *next;
hassof390d2c2004-09-10 20:48:21 +000037 int len;
38 u_char *pass;
jardineb5d44e2003-12-23 08:09:43 +000039};
40
hassof390d2c2004-09-10 20:48:21 +000041struct metric
42{
jardineb5d44e2003-12-23 08:09:43 +000043 u_char metric_default;
44 u_char metric_error;
45 u_char metric_expense;
46 u_char metric_delay;
47};
48
hassof390d2c2004-09-10 20:48:21 +000049struct isis_bcast_info
50{
51 u_char snpa[ETH_ALEN]; /* SNPA of this circuit */
52 char run_dr_elect[2]; /* Should we run dr election ? */
53 struct thread *t_run_dr[2]; /* DR election thread */
54 struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
55 struct list *adjdb[2]; /* adjacency dbs */
56 struct list *lan_neighs[2]; /* list of lx neigh snpa */
57 char is_dr[2]; /* Are we level x DR ? */
58 u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
59 u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
60 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
jardineb5d44e2003-12-23 08:09:43 +000061};
62
hassof390d2c2004-09-10 20:48:21 +000063struct isis_p2p_info
64{
65 struct isis_adjacency *neighbor;
66 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
jardineb5d44e2003-12-23 08:09:43 +000067};
68
hassof390d2c2004-09-10 20:48:21 +000069struct isis_circuit
70{
jardineb5d44e2003-12-23 08:09:43 +000071 int state;
hassof390d2c2004-09-10 20:48:21 +000072 u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */
73 struct isis_area *area; /* back pointer to the area */
74 struct interface *interface; /* interface info from z */
75 int fd; /* IS-IS l1/2 socket */
Paul Jakma238497f2007-08-07 18:49:18 +000076 int sap_length; /* SAP length for DLPI */
hassof390d2c2004-09-10 20:48:21 +000077 struct nlpids nlpids;
jardineb5d44e2003-12-23 08:09:43 +000078 /*
79 * Threads
80 */
81 struct thread *t_read;
82 struct thread *t_send_csnp[2];
83 struct thread *t_send_psnp[2];
hassof390d2c2004-09-10 20:48:21 +000084 struct list *lsp_queue; /* LSPs to be txed (both levels) */
Josh Bailey3f045a02012-03-24 08:35:20 -070085 time_t lsp_queue_last_cleared;/* timestamp used to enforce transmit interval;
86 * for scalability, use one timestamp per
87 * circuit, instead of one per lsp per circuit
88 */
jardineb5d44e2003-12-23 08:09:43 +000089 /* there is no real point in two streams, just for programming kicker */
hassof390d2c2004-09-10 20:48:21 +000090 int (*rx) (struct isis_circuit * circuit, u_char * ssnpa);
91 struct stream *rcv_stream; /* Stream for receiving */
92 int (*tx) (struct isis_circuit * circuit, int level);
93 struct stream *snd_stream; /* Stream for sending */
94 int idx; /* idx in S[RM|SN] flags */
Josh Bailey3f045a02012-03-24 08:35:20 -070095#define CIRCUIT_T_UNKNOWN 0
96#define CIRCUIT_T_BROADCAST 1
97#define CIRCUIT_T_P2P 2
98#define CIRCUIT_T_LOOPBACK 3
hassof390d2c2004-09-10 20:48:21 +000099 int circ_type; /* type of the physical interface */
Josh Bailey3f045a02012-03-24 08:35:20 -0700100 int circ_type_config; /* config type of the physical interface */
hassof390d2c2004-09-10 20:48:21 +0000101 union
102 {
jardineb5d44e2003-12-23 08:09:43 +0000103 struct isis_bcast_info bc;
104 struct isis_p2p_info p2p;
105 } u;
Josh Bailey3f045a02012-03-24 08:35:20 -0700106 u_char priority[2]; /* l1/2 IS configured priority */
107 int pad_hellos; /* add padding to Hello PDUs ? */
hassof390d2c2004-09-10 20:48:21 +0000108 char ext_domain; /* externalDomain (boolean) */
Josh Bailey3f045a02012-03-24 08:35:20 -0700109 int lsp_regenerate_pending[ISIS_LEVELS];
jardineb5d44e2003-12-23 08:09:43 +0000110 /*
111 * Configurables
112 */
hassof390d2c2004-09-10 20:48:21 +0000113 struct isis_passwd passwd; /* Circuit rx/tx password */
Josh Bailey3f045a02012-03-24 08:35:20 -0700114 int is_type; /* circuit is type == level of circuit
Olivier Dugeon4f593572016-04-19 19:03:05 +0200115 * differentiated from circuit type (media) */
hassof390d2c2004-09-10 20:48:21 +0000116 u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */
117 u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */
118 u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */
119 u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */
120 struct metric metrics[2]; /* l1XxxMetric */
hassof21fb272005-09-26 17:05:55 +0000121 u_int32_t te_metric[2];
Olivier Dugeon4f593572016-04-19 19:03:05 +0200122 struct mpls_te_circuit *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
hassof390d2c2004-09-10 20:48:21 +0000123 int ip_router; /* Route IP ? */
Josh Bailey3f045a02012-03-24 08:35:20 -0700124 int is_passive; /* Is Passive ? */
hassof390d2c2004-09-10 20:48:21 +0000125 struct list *ip_addrs; /* our IP addresses */
jardineb5d44e2003-12-23 08:09:43 +0000126#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000127 int ipv6_router; /* Route IPv6 ? */
128 struct list *ipv6_link; /* our link local IPv6 addresses */
129 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
130#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000131 u_int16_t upadjcount[2];
Josh Bailey3f045a02012-03-24 08:35:20 -0700132#define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
133 u_char flags;
jardineb5d44e2003-12-23 08:09:43 +0000134 /*
135 * Counters as in 10589--11.2.5.9
136 */
hassof390d2c2004-09-10 20:48:21 +0000137 u_int32_t adj_state_changes; /* changesInAdjacencyState */
138 u_int32_t init_failures; /* intialisationFailures */
139 u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */
140 u_int32_t ctrl_pdus_txed; /* controlPDUsSent */
141 u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
142 u_int32_t rej_adjacencies; /* rejectedAdjacencies */
jardineb5d44e2003-12-23 08:09:43 +0000143};
144
hassof390d2c2004-09-10 20:48:21 +0000145void isis_circuit_init (void);
146struct isis_circuit *isis_circuit_new (void);
Josh Bailey3f045a02012-03-24 08:35:20 -0700147void isis_circuit_del (struct isis_circuit *circuit);
hassof390d2c2004-09-10 20:48:21 +0000148struct isis_circuit *circuit_lookup_by_ifp (struct interface *ifp,
149 struct list *list);
150struct isis_circuit *circuit_scan_by_ifp (struct interface *ifp);
hassof390d2c2004-09-10 20:48:21 +0000151void isis_circuit_configure (struct isis_circuit *circuit,
152 struct isis_area *area);
hassof390d2c2004-09-10 20:48:21 +0000153void isis_circuit_deconfigure (struct isis_circuit *circuit,
154 struct isis_area *area);
hassof390d2c2004-09-10 20:48:21 +0000155void isis_circuit_if_add (struct isis_circuit *circuit,
156 struct interface *ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -0700157void isis_circuit_if_del (struct isis_circuit *circuit,
158 struct interface *ifp);
159void isis_circuit_if_bind (struct isis_circuit *circuit,
160 struct interface *ifp);
161void isis_circuit_if_unbind (struct isis_circuit *circuit,
162 struct interface *ifp);
hassof390d2c2004-09-10 20:48:21 +0000163void isis_circuit_add_addr (struct isis_circuit *circuit,
164 struct connected *conn);
165void isis_circuit_del_addr (struct isis_circuit *circuit,
166 struct connected *conn);
Josh Bailey3f045a02012-03-24 08:35:20 -0700167int isis_circuit_up (struct isis_circuit *circuit);
168void isis_circuit_down (struct isis_circuit *);
169void circuit_update_nlpids (struct isis_circuit *circuit);
170void isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
171 char detail);
Christian Frankef1fc1db2015-11-10 18:43:31 +0100172size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
173void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
Josh Bailey3f045a02012-03-24 08:35:20 -0700174
David Lamparter3732cba2016-07-29 16:19:40 +0200175struct isis_circuit *isis_circuit_create (struct isis_area *area, struct interface *ifp);
176void isis_circuit_af_set (struct isis_circuit *circuit, bool ip_router, bool ipv6_router);
177int isis_circuit_passive_set (struct isis_circuit *circuit, bool passive);
178void isis_circuit_is_type_set (struct isis_circuit *circuit, int is_type);
179int isis_circuit_circ_type_set (struct isis_circuit *circuit, int circ_type);
180
181int isis_circuit_metric_set (struct isis_circuit *circuit, int level, int metric);
182
jardineb5d44e2003-12-23 08:09:43 +0000183#endif /* _ZEBRA_ISIS_CIRCUIT_H */