]>
Commit | Line | Data |
---|---|---|
eb5d44eb | 1 | /* |
2 | * IS-IS Rout(e)ing protocol - isis_circuit.h | |
3 | * | |
4 | * Copyright (C) 2001,2002 Sampo Saaristo | |
d62a17ae | 5 | * Tampere University of Technology |
eb5d44eb | 6 | * Institute of Communications Engineering |
7 | * | |
d62a17ae | 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) | |
eb5d44eb | 11 | * any later version. |
12 | * | |
d62a17ae | 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 | |
eb5d44eb | 16 | * more details. |
896014f4 DL |
17 | * |
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 | |
eb5d44eb | 21 | */ |
22 | ||
23 | #ifndef ISIS_CIRCUIT_H | |
24 | #define ISIS_CIRCUIT_H | |
25 | ||
91283e76 | 26 | #include "vty.h" |
65f9a9a8 | 27 | #include "if.h" |
676a4ea3 | 28 | #include "qobj.h" |
d1be6968 | 29 | #include "prefix.h" |
64dd3ffe | 30 | #include "ferr.h" |
65f9a9a8 DL |
31 | |
32 | #include "isis_constants.h" | |
33 | #include "isis_common.h" | |
91283e76 | 34 | |
eb5d44eb | 35 | #define CIRCUIT_MAX 255 |
36 | ||
58e16237 CF |
37 | struct isis_lsp; |
38 | ||
d62a17ae | 39 | struct password { |
40 | struct password *next; | |
41 | int len; | |
42 | u_char *pass; | |
eb5d44eb | 43 | }; |
44 | ||
d62a17ae | 45 | struct metric { |
46 | u_char metric_default; | |
47 | u_char metric_error; | |
48 | u_char metric_expense; | |
49 | u_char metric_delay; | |
eb5d44eb | 50 | }; |
51 | ||
d62a17ae | 52 | struct isis_bcast_info { |
53 | u_char snpa[ETH_ALEN]; /* SNPA of this circuit */ | |
54 | char run_dr_elect[2]; /* Should we run dr election ? */ | |
55 | struct thread *t_run_dr[2]; /* DR election thread */ | |
56 | struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */ | |
57 | struct list *adjdb[2]; /* adjacency dbs */ | |
58 | struct list *lan_neighs[2]; /* list of lx neigh snpa */ | |
59 | char is_dr[2]; /* Are we level x DR ? */ | |
60 | u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ | |
61 | u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */ | |
62 | struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */ | |
eb5d44eb | 63 | }; |
64 | ||
d62a17ae | 65 | struct isis_p2p_info { |
66 | struct isis_adjacency *neighbor; | |
67 | struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */ | |
eb5d44eb | 68 | }; |
69 | ||
d62a17ae | 70 | struct isis_circuit { |
71 | int state; | |
72 | 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 */ | |
76 | int sap_length; /* SAP length for DLPI */ | |
77 | struct nlpids nlpids; | |
78 | /* | |
79 | * Threads | |
80 | */ | |
81 | struct thread *t_read; | |
82 | struct thread *t_send_csnp[2]; | |
83 | struct thread *t_send_psnp[2]; | |
58e16237 | 84 | struct thread *t_send_lsp; |
d62a17ae | 85 | struct list *lsp_queue; /* LSPs to be txed (both levels) */ |
58e16237 | 86 | struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */ |
c60158ae | 87 | time_t lsp_queue_last_push[2]; /* timestamp used to enforce transmit |
d62a17ae | 88 | * interval; |
89 | * for scalability, use one timestamp per | |
90 | * circuit, instead of one per lsp per | |
91 | * circuit | |
92 | */ | |
93 | /* there is no real point in two streams, just for programming kicker */ | |
94 | int (*rx)(struct isis_circuit *circuit, u_char *ssnpa); | |
95 | struct stream *rcv_stream; /* Stream for receiving */ | |
96 | int (*tx)(struct isis_circuit *circuit, int level); | |
97 | struct stream *snd_stream; /* Stream for sending */ | |
98 | int idx; /* idx in S[RM|SN] flags */ | |
99 | /* $FRR indent$ */ | |
100 | /* clang-format off */ | |
3f045a08 JB |
101 | #define CIRCUIT_T_UNKNOWN 0 |
102 | #define CIRCUIT_T_BROADCAST 1 | |
103 | #define CIRCUIT_T_P2P 2 | |
104 | #define CIRCUIT_T_LOOPBACK 3 | |
d62a17ae | 105 | int circ_type; /* type of the physical interface */ |
106 | int circ_type_config; /* config type of the physical interface */ | |
107 | union { | |
108 | struct isis_bcast_info bc; | |
109 | struct isis_p2p_info p2p; | |
110 | } u; | |
111 | u_char priority[2]; /* l1/2 IS configured priority */ | |
112 | int pad_hellos; /* add padding to Hello PDUs ? */ | |
113 | char ext_domain; /* externalDomain (boolean) */ | |
114 | int lsp_regenerate_pending[ISIS_LEVELS]; | |
115 | /* | |
116 | * Configurables | |
117 | */ | |
118 | struct isis_passwd passwd; /* Circuit rx/tx password */ | |
119 | int is_type; /* circuit is type == level of circuit | |
120 | * differentiated from circuit type (media) */ | |
121 | u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */ | |
122 | u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */ | |
123 | u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ | |
124 | u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ | |
125 | u_int8_t metric[2]; | |
126 | u_int32_t te_metric[2]; | |
127 | struct mpls_te_circuit | |
128 | *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */ | |
129 | int ip_router; /* Route IP ? */ | |
130 | int is_passive; /* Is Passive ? */ | |
131 | struct list *mt_settings; /* IS-IS MT Settings */ | |
132 | struct list *ip_addrs; /* our IP addresses */ | |
133 | int ipv6_router; /* Route IPv6 ? */ | |
134 | struct list *ipv6_link; /* our link local IPv6 addresses */ | |
135 | struct list *ipv6_non_link; /* our non-link local IPv6 addresses */ | |
136 | u_int16_t upadjcount[2]; | |
3f045a08 | 137 | #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01 |
d62a17ae | 138 | u_char flags; |
139 | /* | |
140 | * Counters as in 10589--11.2.5.9 | |
141 | */ | |
142 | u_int32_t adj_state_changes; /* changesInAdjacencyState */ | |
143 | u_int32_t init_failures; /* intialisationFailures */ | |
144 | u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */ | |
145 | u_int32_t ctrl_pdus_txed; /* controlPDUsSent */ | |
146 | u_int32_t | |
147 | desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */ | |
148 | u_int32_t rej_adjacencies; /* rejectedAdjacencies */ | |
149 | ||
150 | QOBJ_FIELDS | |
eb5d44eb | 151 | }; |
676a4ea3 | 152 | DECLARE_QOBJ_TYPE(isis_circuit) |
eb5d44eb | 153 | |
d62a17ae | 154 | void isis_circuit_init(void); |
155 | struct isis_circuit *isis_circuit_new(void); | |
156 | void isis_circuit_del(struct isis_circuit *circuit); | |
157 | struct isis_circuit *circuit_lookup_by_ifp(struct interface *ifp, | |
158 | struct list *list); | |
159 | struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp); | |
160 | void isis_circuit_configure(struct isis_circuit *circuit, | |
161 | struct isis_area *area); | |
162 | void isis_circuit_deconfigure(struct isis_circuit *circuit, | |
163 | struct isis_area *area); | |
164 | void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp); | |
165 | void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp); | |
166 | void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp); | |
167 | void isis_circuit_if_unbind(struct isis_circuit *circuit, | |
168 | struct interface *ifp); | |
169 | void isis_circuit_add_addr(struct isis_circuit *circuit, | |
170 | struct connected *conn); | |
171 | void isis_circuit_del_addr(struct isis_circuit *circuit, | |
172 | struct connected *conn); | |
173 | void isis_circuit_prepare(struct isis_circuit *circuit); | |
174 | int isis_circuit_up(struct isis_circuit *circuit); | |
175 | void isis_circuit_down(struct isis_circuit *); | |
176 | void circuit_update_nlpids(struct isis_circuit *circuit); | |
177 | void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty, | |
178 | char detail); | |
b20ccb3a CF |
179 | size_t isis_circuit_pdu_size(struct isis_circuit *circuit); |
180 | void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream); | |
3f045a08 | 181 | |
d62a17ae | 182 | struct isis_circuit *isis_circuit_create(struct isis_area *area, |
183 | struct interface *ifp); | |
184 | void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router, | |
185 | bool ipv6_router); | |
64dd3ffe | 186 | ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive); |
d62a17ae | 187 | void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type); |
64dd3ffe | 188 | ferr_r isis_circuit_circ_type_set (struct isis_circuit *circuit, int circ_type); |
d62a17ae | 189 | |
64dd3ffe DL |
190 | ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level, |
191 | int metric); | |
d62a17ae | 192 | |
64dd3ffe DL |
193 | ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit); |
194 | ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit, | |
195 | const char *passwd); | |
196 | ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit, | |
197 | const char *passwd); | |
d62a17ae | 198 | |
199 | int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid, | |
200 | bool enabled); | |
064f4896 | 201 | |
58e16237 CF |
202 | void isis_circuit_schedule_lsp_send(struct isis_circuit *circuit); |
203 | void isis_circuit_queue_lsp(struct isis_circuit *circuit, struct isis_lsp *lsp); | |
204 | void isis_circuit_lsp_queue_clean(struct isis_circuit *circuit); | |
205 | void isis_circuit_cancel_queued_lsp(struct isis_circuit *circuit, | |
206 | struct isis_lsp *lsp); | |
207 | struct isis_lsp *isis_circuit_lsp_queue_pop(struct isis_circuit *circuit); | |
eb5d44eb | 208 | #endif /* _ZEBRA_ISIS_CIRCUIT_H */ |