]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_circuit.h
Merge pull request #3167 from chiragshah6/ospfv3_dev
[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; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 #include "prefix.h"
30 #include "ferr.h"
31
32 #include "isis_constants.h"
33 #include "isis_common.h"
34
35 struct isis_lsp;
36
37 struct password {
38 struct password *next;
39 int len;
40 uint8_t *pass;
41 };
42
43 struct metric {
44 uint8_t metric_default;
45 uint8_t metric_error;
46 uint8_t metric_expense;
47 uint8_t metric_delay;
48 };
49
50 struct isis_bcast_info {
51 uint8_t 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 uint8_t l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
59 uint8_t l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
60 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
61 };
62
63 struct isis_p2p_info {
64 struct isis_adjacency *neighbor;
65 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
66 };
67
68 struct bfd_info;
69
70 struct isis_circuit {
71 int state;
72 uint8_t circuit_id; /* l1/l2 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];
84 struct thread *t_send_lsp;
85 struct isis_tx_queue *tx_queue;
86
87 /* there is no real point in two streams, just for programming kicker */
88 int (*rx)(struct isis_circuit *circuit, uint8_t *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 #define CIRCUIT_T_UNKNOWN 0
94 #define CIRCUIT_T_BROADCAST 1
95 #define CIRCUIT_T_P2P 2
96 #define CIRCUIT_T_LOOPBACK 3
97 int circ_type; /* type of the physical interface */
98 int circ_type_config; /* config type of the physical interface */
99 union {
100 struct isis_bcast_info bc;
101 struct isis_p2p_info p2p;
102 } u;
103 uint8_t priority[2]; /* l1/2 IS configured priority */
104 int pad_hellos; /* add padding to Hello PDUs ? */
105 char ext_domain; /* externalDomain (boolean) */
106 int lsp_regenerate_pending[ISIS_LEVELS];
107 /*
108 * Configurables
109 */
110 struct isis_passwd passwd; /* Circuit rx/tx password */
111 int is_type; /* circuit is type == level of circuit
112 * differentiated from circuit type (media) */
113 uint32_t hello_interval[2]; /* hello-interval in seconds */
114 uint16_t hello_multiplier[2]; /* hello-multiplier */
115 uint16_t csnp_interval[2]; /* csnp-interval in seconds */
116 uint16_t psnp_interval[2]; /* psnp-interval in seconds */
117 uint8_t metric[2];
118 uint32_t te_metric[2];
119 struct mpls_te_circuit
120 *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
121 int ip_router; /* Route IP ? */
122 int is_passive; /* Is Passive ? */
123 struct list *mt_settings; /* IS-IS MT Settings */
124 struct list *ip_addrs; /* our IP addresses */
125 int ipv6_router; /* Route IPv6 ? */
126 struct list *ipv6_link; /* our link local IPv6 addresses */
127 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
128 uint16_t upadjcount[2];
129 #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
130 uint8_t flags;
131 bool disable_threeway_adj;
132 struct bfd_info *bfd_info;
133 /*
134 * Counters as in 10589--11.2.5.9
135 */
136 uint32_t adj_state_changes; /* changesInAdjacencyState */
137 uint32_t init_failures; /* intialisationFailures */
138 uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */
139 uint32_t ctrl_pdus_txed; /* controlPDUsSent */
140 uint32_t
141 desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
142 uint32_t rej_adjacencies; /* rejectedAdjacencies */
143
144 QOBJ_FIELDS
145 };
146 DECLARE_QOBJ_TYPE(isis_circuit)
147
148 void isis_circuit_init(void);
149 struct isis_circuit *isis_circuit_new(void);
150 void isis_circuit_del(struct isis_circuit *circuit);
151 struct isis_circuit *circuit_lookup_by_ifp(struct interface *ifp,
152 struct list *list);
153 struct isis_circuit *circuit_scan_by_ifp(struct interface *ifp);
154 void isis_circuit_configure(struct isis_circuit *circuit,
155 struct isis_area *area);
156 void isis_circuit_deconfigure(struct isis_circuit *circuit,
157 struct isis_area *area);
158 void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp);
159 void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp);
160 void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp);
161 void isis_circuit_if_unbind(struct isis_circuit *circuit,
162 struct interface *ifp);
163 void isis_circuit_add_addr(struct isis_circuit *circuit,
164 struct connected *conn);
165 void isis_circuit_del_addr(struct isis_circuit *circuit,
166 struct connected *conn);
167 void isis_circuit_prepare(struct isis_circuit *circuit);
168 int isis_circuit_up(struct isis_circuit *circuit);
169 void isis_circuit_down(struct isis_circuit *);
170 void circuit_update_nlpids(struct isis_circuit *circuit);
171 void isis_circuit_print_vty(struct isis_circuit *circuit, struct vty *vty,
172 char detail);
173 size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
174 void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
175
176 struct isis_circuit *isis_circuit_create(struct isis_area *area,
177 struct interface *ifp);
178 void isis_circuit_af_set(struct isis_circuit *circuit, bool ip_router,
179 bool ipv6_router);
180 ferr_r isis_circuit_passive_set(struct isis_circuit *circuit, bool passive);
181 void isis_circuit_is_type_set(struct isis_circuit *circuit, int is_type);
182 ferr_r isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type);
183
184 ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
185 int metric);
186
187 ferr_r isis_circuit_passwd_unset(struct isis_circuit *circuit);
188 ferr_r isis_circuit_passwd_cleartext_set(struct isis_circuit *circuit,
189 const char *passwd);
190 ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
191 const char *passwd);
192
193 int isis_circuit_mt_enabled_set(struct isis_circuit *circuit, uint16_t mtid,
194 bool enabled);
195
196 DECLARE_HOOK(isis_circuit_config_write,
197 (struct isis_circuit *circuit, struct vty *vty),
198 (circuit, vty))
199
200 #endif /* _ZEBRA_ISIS_CIRCUIT_H */