]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_lfa.h
Merge pull request #7375 from vishaldhingra/static
[mirror_frr.git] / isisd / isis_lfa.h
1 /*
2 * Copyright (C) 2020 NetDEF, Inc.
3 * Renato Westphal
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _FRR_ISIS_LFA_H
21 #define _FRR_ISIS_LFA_H
22
23 enum isis_tilfa_sid_type {
24 TILFA_SID_PREFIX = 1,
25 TILFA_SID_ADJ,
26 };
27
28 struct isis_tilfa_sid {
29 enum isis_tilfa_sid_type type;
30 union {
31 struct {
32 uint32_t value;
33 bool remote;
34 uint8_t remote_sysid[ISIS_SYS_ID_LEN];
35 } index;
36 mpls_label_t label;
37 } value;
38 };
39
40 RB_HEAD(isis_spf_nodes, isis_spf_node);
41 RB_PROTOTYPE(isis_spf_nodes, isis_spf_node, entry, isis_spf_node_compare)
42 struct isis_spf_node {
43 RB_ENTRY(isis_spf_node) entry;
44
45 /* Node's System ID. */
46 uint8_t sysid[ISIS_SYS_ID_LEN];
47
48 /* Local adjacencies over which this node is reachable. */
49 struct list *adjacencies;
50
51 /* Best metric of all adjacencies used to reach this node. */
52 uint32_t best_metric;
53
54 struct {
55 /* Node's forward SPT. */
56 struct isis_spftree *spftree;
57
58 /* Node's reverse SPT. */
59 struct isis_spftree *spftree_reverse;
60
61 /* Node's P-space. */
62 struct isis_spf_nodes p_space;
63 } lfa;
64 };
65
66 enum lfa_protection_type {
67 LFA_LINK_PROTECTION = 1,
68 LFA_NODE_PROTECTION,
69 };
70
71 struct lfa_protected_resource {
72 /* The protection type. */
73 enum lfa_protection_type type;
74
75 /* The protected adjacency (might be a pseudonode). */
76 uint8_t adjacency[ISIS_SYS_ID_LEN + 1];
77
78 /* List of nodes reachable over the protected interface. */
79 struct isis_spf_nodes nodes;
80 };
81
82 /* Forward declaration(s). */
83 struct isis_vertex;
84
85 /* Prototypes. */
86 void isis_spf_node_list_init(struct isis_spf_nodes *nodes);
87 void isis_spf_node_list_clear(struct isis_spf_nodes *nodes);
88 struct isis_spf_node *isis_spf_node_new(struct isis_spf_nodes *nodes,
89 const uint8_t *sysid);
90 struct isis_spf_node *isis_spf_node_find(const struct isis_spf_nodes *nodes,
91 const uint8_t *sysid);
92 bool isis_lfa_excise_adj_check(const struct isis_spftree *spftree,
93 const uint8_t *id);
94 bool isis_lfa_excise_node_check(const struct isis_spftree *spftree,
95 const uint8_t *id);
96 struct isis_spftree *isis_spf_reverse_run(const struct isis_spftree *spftree);
97 int isis_spf_run_neighbors(struct isis_spftree *spftree);
98 void isis_spf_run_lfa(struct isis_area *area, struct isis_spftree *spftree);
99 int isis_lfa_check(struct isis_spftree *spftree, struct isis_vertex *vertex);
100 struct isis_spftree *
101 isis_tilfa_compute(struct isis_area *area, struct isis_spftree *spftree,
102 struct isis_spftree *spftree_reverse,
103 struct lfa_protected_resource *protected_resource);
104
105 #endif /* _FRR_ISIS_LFA_H */