blob: 7ed481dc2ed76b30653d37e35b6c338d19428409 [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
26#define CIRCUIT_MAX 255
27
hassof390d2c2004-09-10 20:48:21 +000028struct password
29{
jardineb5d44e2003-12-23 08:09:43 +000030 struct password *next;
hassof390d2c2004-09-10 20:48:21 +000031 int len;
32 u_char *pass;
jardineb5d44e2003-12-23 08:09:43 +000033};
34
hassof390d2c2004-09-10 20:48:21 +000035struct metric
36{
jardineb5d44e2003-12-23 08:09:43 +000037 u_char metric_default;
38 u_char metric_error;
39 u_char metric_expense;
40 u_char metric_delay;
41};
42
hassof390d2c2004-09-10 20:48:21 +000043struct isis_bcast_info
44{
45 u_char snpa[ETH_ALEN]; /* SNPA of this circuit */
46 char run_dr_elect[2]; /* Should we run dr election ? */
47 struct thread *t_run_dr[2]; /* DR election thread */
48 struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
49 struct list *adjdb[2]; /* adjacency dbs */
50 struct list *lan_neighs[2]; /* list of lx neigh snpa */
51 char is_dr[2]; /* Are we level x DR ? */
52 u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
53 u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
54 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
jardineb5d44e2003-12-23 08:09:43 +000055};
56
hassof390d2c2004-09-10 20:48:21 +000057struct isis_p2p_info
58{
59 struct isis_adjacency *neighbor;
60 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
jardineb5d44e2003-12-23 08:09:43 +000061};
62
hassof390d2c2004-09-10 20:48:21 +000063struct isis_circuit
64{
jardineb5d44e2003-12-23 08:09:43 +000065 int state;
hassof390d2c2004-09-10 20:48:21 +000066 u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */
67 struct isis_area *area; /* back pointer to the area */
68 struct interface *interface; /* interface info from z */
69 int fd; /* IS-IS l1/2 socket */
Paul Jakma238497f2007-08-07 18:49:18 +000070 int sap_length; /* SAP length for DLPI */
hassof390d2c2004-09-10 20:48:21 +000071 struct nlpids nlpids;
jardineb5d44e2003-12-23 08:09:43 +000072 /*
73 * Threads
74 */
75 struct thread *t_read;
76 struct thread *t_send_csnp[2];
77 struct thread *t_send_psnp[2];
hassof390d2c2004-09-10 20:48:21 +000078 struct list *lsp_queue; /* LSPs to be txed (both levels) */
Josh Bailey3f045a02012-03-24 08:35:20 -070079 time_t lsp_queue_last_cleared;/* timestamp used to enforce transmit interval;
80 * for scalability, use one timestamp per
81 * circuit, instead of one per lsp per circuit
82 */
jardineb5d44e2003-12-23 08:09:43 +000083 /* there is no real point in two streams, just for programming kicker */
hassof390d2c2004-09-10 20:48:21 +000084 int (*rx) (struct isis_circuit * circuit, u_char * ssnpa);
85 struct stream *rcv_stream; /* Stream for receiving */
86 int (*tx) (struct isis_circuit * circuit, int level);
87 struct stream *snd_stream; /* Stream for sending */
88 int idx; /* idx in S[RM|SN] flags */
Josh Bailey3f045a02012-03-24 08:35:20 -070089#define CIRCUIT_T_UNKNOWN 0
90#define CIRCUIT_T_BROADCAST 1
91#define CIRCUIT_T_P2P 2
92#define CIRCUIT_T_LOOPBACK 3
hassof390d2c2004-09-10 20:48:21 +000093 int circ_type; /* type of the physical interface */
Josh Bailey3f045a02012-03-24 08:35:20 -070094 int circ_type_config; /* config type of the physical interface */
hassof390d2c2004-09-10 20:48:21 +000095 union
96 {
jardineb5d44e2003-12-23 08:09:43 +000097 struct isis_bcast_info bc;
98 struct isis_p2p_info p2p;
99 } u;
Josh Bailey3f045a02012-03-24 08:35:20 -0700100 u_char priority[2]; /* l1/2 IS configured priority */
101 int pad_hellos; /* add padding to Hello PDUs ? */
hassof390d2c2004-09-10 20:48:21 +0000102 char ext_domain; /* externalDomain (boolean) */
Josh Bailey3f045a02012-03-24 08:35:20 -0700103 int lsp_regenerate_pending[ISIS_LEVELS];
jardineb5d44e2003-12-23 08:09:43 +0000104 /*
105 * Configurables
106 */
hassof390d2c2004-09-10 20:48:21 +0000107 struct isis_passwd passwd; /* Circuit rx/tx password */
Josh Bailey3f045a02012-03-24 08:35:20 -0700108 int is_type; /* circuit is type == level of circuit
hassof390d2c2004-09-10 20:48:21 +0000109 * diffrenciated from circuit type (media) */
110 u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */
111 u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */
112 u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */
113 u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */
114 struct metric metrics[2]; /* l1XxxMetric */
hassof21fb272005-09-26 17:05:55 +0000115 u_int32_t te_metric[2];
hassof390d2c2004-09-10 20:48:21 +0000116 int ip_router; /* Route IP ? */
Josh Bailey3f045a02012-03-24 08:35:20 -0700117 int is_passive; /* Is Passive ? */
hassof390d2c2004-09-10 20:48:21 +0000118 struct list *ip_addrs; /* our IP addresses */
jardineb5d44e2003-12-23 08:09:43 +0000119#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000120 int ipv6_router; /* Route IPv6 ? */
121 struct list *ipv6_link; /* our link local IPv6 addresses */
122 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
123#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000124 u_int16_t upadjcount[2];
Josh Bailey3f045a02012-03-24 08:35:20 -0700125#define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
126 u_char flags;
jardineb5d44e2003-12-23 08:09:43 +0000127 /*
128 * Counters as in 10589--11.2.5.9
129 */
hassof390d2c2004-09-10 20:48:21 +0000130 u_int32_t adj_state_changes; /* changesInAdjacencyState */
131 u_int32_t init_failures; /* intialisationFailures */
132 u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */
133 u_int32_t ctrl_pdus_txed; /* controlPDUsSent */
134 u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
135 u_int32_t rej_adjacencies; /* rejectedAdjacencies */
jardineb5d44e2003-12-23 08:09:43 +0000136};
137
hassof390d2c2004-09-10 20:48:21 +0000138void isis_circuit_init (void);
139struct isis_circuit *isis_circuit_new (void);
Josh Bailey3f045a02012-03-24 08:35:20 -0700140void isis_circuit_del (struct isis_circuit *circuit);
hassof390d2c2004-09-10 20:48:21 +0000141struct isis_circuit *circuit_lookup_by_ifp (struct interface *ifp,
142 struct list *list);
143struct isis_circuit *circuit_scan_by_ifp (struct interface *ifp);
hassof390d2c2004-09-10 20:48:21 +0000144void isis_circuit_configure (struct isis_circuit *circuit,
145 struct isis_area *area);
hassof390d2c2004-09-10 20:48:21 +0000146void isis_circuit_deconfigure (struct isis_circuit *circuit,
147 struct isis_area *area);
hassof390d2c2004-09-10 20:48:21 +0000148void isis_circuit_if_add (struct isis_circuit *circuit,
149 struct interface *ifp);
Josh Bailey3f045a02012-03-24 08:35:20 -0700150void isis_circuit_if_del (struct isis_circuit *circuit,
151 struct interface *ifp);
152void isis_circuit_if_bind (struct isis_circuit *circuit,
153 struct interface *ifp);
154void isis_circuit_if_unbind (struct isis_circuit *circuit,
155 struct interface *ifp);
hassof390d2c2004-09-10 20:48:21 +0000156void isis_circuit_add_addr (struct isis_circuit *circuit,
157 struct connected *conn);
158void isis_circuit_del_addr (struct isis_circuit *circuit,
159 struct connected *conn);
Josh Bailey3f045a02012-03-24 08:35:20 -0700160int isis_circuit_up (struct isis_circuit *circuit);
161void isis_circuit_down (struct isis_circuit *);
162void circuit_update_nlpids (struct isis_circuit *circuit);
163void isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
164 char detail);
165
jardineb5d44e2003-12-23 08:09:43 +0000166#endif /* _ZEBRA_ISIS_CIRCUIT_H */