2 * IS-IS Rout(e)ing protocol - isis_circuit.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
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)
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
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef ISIS_CIRCUIT_H
24 #define ISIS_CIRCUIT_H
32 #include "isis_constants.h"
33 #include "isis_common.h"
35 #define CIRCUIT_MAX 255
38 struct password
*next
;
44 u_char metric_default
;
46 u_char metric_expense
;
50 struct isis_bcast_info
{
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 */
63 struct isis_p2p_info
{
64 struct isis_adjacency
*neighbor
;
65 struct thread
*t_send_p2p_hello
; /* send P2P IIHs in this thread */
70 u_char circuit_id
; /* l1/l2 p2p/bcast CircuitID */
71 struct isis_area
*area
; /* back pointer to the area */
72 struct interface
*interface
; /* interface info from z */
73 int fd
; /* IS-IS l1/2 socket */
74 int sap_length
; /* SAP length for DLPI */
79 struct thread
*t_read
;
80 struct thread
*t_send_csnp
[2];
81 struct thread
*t_send_psnp
[2];
82 struct list
*lsp_queue
; /* LSPs to be txed (both levels) */
83 time_t lsp_queue_last_cleared
; /* timestamp used to enforce transmit
85 * for scalability, use one timestamp per
86 * circuit, instead of one per lsp per
89 /* there is no real point in two streams, just for programming kicker */
90 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 */
96 /* clang-format off */
97 #define CIRCUIT_T_UNKNOWN 0
98 #define CIRCUIT_T_BROADCAST 1
99 #define CIRCUIT_T_P2P 2
100 #define CIRCUIT_T_LOOPBACK 3
101 int circ_type
; /* type of the physical interface */
102 int circ_type_config
; /* config type of the physical interface */
104 struct isis_bcast_info bc
;
105 struct isis_p2p_info p2p
;
107 u_char priority
[2]; /* l1/2 IS configured priority */
108 int pad_hellos
; /* add padding to Hello PDUs ? */
109 char ext_domain
; /* externalDomain (boolean) */
110 int lsp_regenerate_pending
[ISIS_LEVELS
];
114 struct isis_passwd passwd
; /* Circuit rx/tx password */
115 int is_type
; /* circuit is type == level of circuit
116 * differentiated from circuit type (media) */
117 u_int32_t hello_interval
[2]; /* l1HelloInterval in msecs */
118 u_int16_t hello_multiplier
[2]; /* l1HelloMultiplier */
119 u_int16_t csnp_interval
[2]; /* level-1 csnp-interval in seconds */
120 u_int16_t psnp_interval
[2]; /* level-1 psnp-interval in seconds */
122 u_int32_t te_metric
[2];
123 struct mpls_te_circuit
124 *mtc
; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
125 int ip_router
; /* Route IP ? */
126 int is_passive
; /* Is Passive ? */
127 struct list
*mt_settings
; /* IS-IS MT Settings */
128 struct list
*ip_addrs
; /* our IP addresses */
129 int ipv6_router
; /* Route IPv6 ? */
130 struct list
*ipv6_link
; /* our link local IPv6 addresses */
131 struct list
*ipv6_non_link
; /* our non-link local IPv6 addresses */
132 u_int16_t upadjcount
[2];
133 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
136 * Counters as in 10589--11.2.5.9
138 u_int32_t adj_state_changes
; /* changesInAdjacencyState */
139 u_int32_t init_failures
; /* intialisationFailures */
140 u_int32_t ctrl_pdus_rxed
; /* controlPDUsReceived */
141 u_int32_t ctrl_pdus_txed
; /* controlPDUsSent */
143 desig_changes
[2]; /* lanLxDesignatedIntermediateSystemChanges */
144 u_int32_t rej_adjacencies
; /* rejectedAdjacencies */
148 DECLARE_QOBJ_TYPE(isis_circuit
)
150 void isis_circuit_init(void);
151 struct isis_circuit
*isis_circuit_new(void);
152 void isis_circuit_del(struct isis_circuit
*circuit
);
153 struct isis_circuit
*circuit_lookup_by_ifp(struct interface
*ifp
,
155 struct isis_circuit
*circuit_scan_by_ifp(struct interface
*ifp
);
156 void isis_circuit_configure(struct isis_circuit
*circuit
,
157 struct isis_area
*area
);
158 void isis_circuit_deconfigure(struct isis_circuit
*circuit
,
159 struct isis_area
*area
);
160 void isis_circuit_if_add(struct isis_circuit
*circuit
, struct interface
*ifp
);
161 void isis_circuit_if_del(struct isis_circuit
*circuit
, struct interface
*ifp
);
162 void isis_circuit_if_bind(struct isis_circuit
*circuit
, struct interface
*ifp
);
163 void isis_circuit_if_unbind(struct isis_circuit
*circuit
,
164 struct interface
*ifp
);
165 void isis_circuit_add_addr(struct isis_circuit
*circuit
,
166 struct connected
*conn
);
167 void isis_circuit_del_addr(struct isis_circuit
*circuit
,
168 struct connected
*conn
);
169 void isis_circuit_prepare(struct isis_circuit
*circuit
);
170 int isis_circuit_up(struct isis_circuit
*circuit
);
171 void isis_circuit_down(struct isis_circuit
*);
172 void circuit_update_nlpids(struct isis_circuit
*circuit
);
173 void isis_circuit_print_vty(struct isis_circuit
*circuit
, struct vty
*vty
,
175 size_t isis_circuit_pdu_size(struct isis_circuit
*circuit
);
176 void isis_circuit_stream(struct isis_circuit
*circuit
, struct stream
**stream
);
178 struct isis_circuit
*isis_circuit_create(struct isis_area
*area
,
179 struct interface
*ifp
);
180 void isis_circuit_af_set(struct isis_circuit
*circuit
, bool ip_router
,
182 ferr_r
isis_circuit_passive_set(struct isis_circuit
*circuit
, bool passive
);
183 void isis_circuit_is_type_set(struct isis_circuit
*circuit
, int is_type
);
184 ferr_r
isis_circuit_circ_type_set (struct isis_circuit
*circuit
, int circ_type
);
186 ferr_r
isis_circuit_metric_set(struct isis_circuit
*circuit
, int level
,
189 ferr_r
isis_circuit_passwd_unset(struct isis_circuit
*circuit
);
190 ferr_r
isis_circuit_passwd_cleartext_set(struct isis_circuit
*circuit
,
192 ferr_r
isis_circuit_passwd_hmac_md5_set(struct isis_circuit
*circuit
,
195 int isis_circuit_mt_enabled_set(struct isis_circuit
*circuit
, uint16_t mtid
,
198 #endif /* _ZEBRA_ISIS_CIRCUIT_H */