]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_circuit.h
release: FRR 3.0-rc1
[mirror_frr.git] / isisd / isis_circuit.h
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
26 #include "vty.h"
27 #include "if.h"
28 #include "qobj.h"
29
30 #include "isis_constants.h"
31 #include "isis_common.h"
32
33 #define CIRCUIT_MAX 255
34
35 struct password {
36 struct password *next;
37 int len;
38 u_char *pass;
39 };
40
41 struct metric {
42 u_char metric_default;
43 u_char metric_error;
44 u_char metric_expense;
45 u_char metric_delay;
46 };
47
48 struct isis_bcast_info {
49 u_char snpa[ETH_ALEN]; /* SNPA of this circuit */
50 char run_dr_elect[2]; /* Should we run dr election ? */
51 struct thread *t_run_dr[2]; /* DR election thread */
52 struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
53 struct list *adjdb[2]; /* adjacency dbs */
54 struct list *lan_neighs[2]; /* list of lx neigh snpa */
55 char is_dr[2]; /* Are we level x DR ? */
56 u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
57 u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
58 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
59 };
60
61 struct isis_p2p_info {
62 struct isis_adjacency *neighbor;
63 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
64 };
65
66 struct isis_circuit {
67 int state;
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 */
72 int sap_length; /* SAP length for DLPI */
73 struct nlpids nlpids;
74 /*
75 * Threads
76 */
77 struct thread *t_read;
78 struct thread *t_send_csnp[2];
79 struct thread *t_send_psnp[2];
80 struct list *lsp_queue; /* LSPs to be txed (both levels) */
81 time_t lsp_queue_last_cleared; /* timestamp used to enforce transmit
82 * interval;
83 * for scalability, use one timestamp per
84 * circuit, instead of one per lsp per
85 * circuit
86 */
87 /* there is no real point in two streams, just for programming kicker */
88 int (*rx)(struct isis_circuit *circuit, u_char *ssnpa);
89 struct stream *rcv_stream; /* Stream for receiving */
90 int (*tx)(struct isis_circuit *circuit, int level);
91 struct stream *snd_stream; /* Stream for sending */
92 int idx; /* idx in S[RM|SN] flags */
93 /* $FRR indent$ */
94 /* clang-format off */
95 #define CIRCUIT_T_UNKNOWN 0
96 #define CIRCUIT_T_BROADCAST 1
97 #define CIRCUIT_T_P2P 2
98 #define CIRCUIT_T_LOOPBACK 3
99 int circ_type; /* type of the physical interface */
100 int circ_type_config; /* config type of the physical interface */
101 union {
102 struct isis_bcast_info bc;
103 struct isis_p2p_info p2p;
104 } u;
105 u_char priority[2]; /* l1/2 IS configured priority */
106 int pad_hellos; /* add padding to Hello PDUs ? */
107 char ext_domain; /* externalDomain (boolean) */
108 int lsp_regenerate_pending[ISIS_LEVELS];
109 /*
110 * Configurables
111 */
112 struct isis_passwd passwd; /* Circuit rx/tx password */
113 int is_type; /* circuit is type == level of circuit
114 * differentiated from circuit type (media) */
115 u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */
116 u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */
117 u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */
118 u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */
119 u_int8_t metric[2];
120 u_int32_t te_metric[2];
121 struct mpls_te_circuit
122 *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
123 int ip_router; /* Route IP ? */
124 int is_passive; /* Is Passive ? */
125 struct list *ip_addrs; /* our IP addresses */
126 int ipv6_router; /* Route IPv6 ? */
127 struct list *ipv6_link; /* our link local IPv6 addresses */
128 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
129 u_int16_t upadjcount[2];
130 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
131 u_char flags;
132 /*
133 * Counters as in 10589--11.2.5.9
134 */
135 u_int32_t adj_state_changes; /* changesInAdjacencyState */
136 u_int32_t init_failures; /* intialisationFailures */
137 u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */
138 u_int32_t ctrl_pdus_txed; /* controlPDUsSent */
139 u_int32_t
140 desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
141 u_int32_t rej_adjacencies; /* rejectedAdjacencies */
142
143 QOBJ_FIELDS
144 };
145 DECLARE_QOBJ_TYPE(isis_circuit)
146
147 void isis_circuit_init(void);
148 struct isis_circuit *isis_circuit_new(void);
149 void isis_circuit_del(struct isis_circuit *circuit);
150 struct isis_circuit *circuit_lookup_by_ifp(struct interface *ifp,
151 struct list *list);
152 struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp);
153 void isis_circuit_configure(struct isis_circuit *circuit,
154 struct isis_area *area);
155 void isis_circuit_deconfigure(struct isis_circuit *circuit,
156 struct isis_area *area);
157 void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp);
158 void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp);
159 void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp);
160 void isis_circuit_if_unbind(struct isis_circuit *circuit,
161 struct interface *ifp);
162 void isis_circuit_add_addr(struct isis_circuit *circuit,
163 struct connected *conn);
164 void isis_circuit_del_addr(struct isis_circuit *circuit,
165 struct connected *conn);
166 void isis_circuit_prepare(struct isis_circuit *circuit);
167 int isis_circuit_up(struct isis_circuit *circuit);
168 void isis_circuit_down(struct isis_circuit *);
169 void circuit_update_nlpids(struct isis_circuit *circuit);
170 void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
171 char detail);
172 size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
173 void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
174
175 struct isis_circuit *isis_circuit_create(struct isis_area *area,
176 struct interface *ifp);
177 void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
178 bool ipv6_router);
179 int isis_circuit_passive_set(struct isis_circuit *circuit, bool passive);
180 void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type);
181 int isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type);
182
183 int isis_circuit_metric_set(struct isis_circuit *circuit, int level,
184 int metric);
185
186 int isis_circuit_passwd_unset(struct isis_circuit *circuit);
187 int isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
188 const char *passwd);
189 int isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
190 const char *passwd);
191
192 #endif /* _ZEBRA_ISIS_CIRCUIT_H */