summaryrefslogtreecommitdiff
path: root/isisd/isis_lsp.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-08-20 21:27:56 -0300
committerRenato Westphal <renato@opensourcerouting.org>2020-08-26 20:16:19 -0300
commit98a496368a8d1c5c2d1caf35142ecfae55cae615 (patch)
tree30894938c61e7e73caa1894dc6ce12c4d1def6f9 /isisd/isis_lsp.h
parent0af5e414d1b1a6a89aee261f3fea9e32310714ea (diff)
isisd: introduce two LSP iteration functions
Iterating over all IP or IS reachability information from a given LSP isn't a trivial task. That information is scattered throughout different TLV types, and which ones need to be used depend on multiple variables (e.g. the SPF tree address family, MT-ID, etc). This not to mention that an LSP might consist of multiple fragments. Introduce the following two LSP iteration function to facilitate obtaining IP/IS reachability information from a given LSP: * isis_lsp_iterate_ip_reach() * isis_lsp_iterate_is_reach() These functions will be used extensively by the upcoming TI-LFA code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_lsp.h')
-rw-r--r--isisd/isis_lsp.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h
index 6cbea47496..0783036e49 100644
--- a/isisd/isis_lsp.h
+++ b/isisd/isis_lsp.h
@@ -127,6 +127,26 @@ int lsp_print_all(struct vty *vty, struct lspdb_head *head, char detail,
/* sets SRMflags for all active circuits of an lsp */
void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set);
+#define LSP_ITER_CONTINUE 0
+#define LSP_ITER_STOP -1
+
+/* Callback used by isis_lsp_iterate_ip_reach() function. */
+struct isis_subtlvs;
+typedef int (*lsp_ip_reach_iter_cb)(const struct prefix *prefix,
+ uint32_t metric, bool external,
+ struct isis_subtlvs *subtlvs, void *arg);
+
+/* Callback used by isis_lsp_iterate_is_reach() function. */
+typedef int (*lsp_is_reach_iter_cb)(const uint8_t *id, uint32_t metric,
+ bool oldmetric,
+ struct isis_ext_subtlvs *subtlvs,
+ void *arg);
+
+int isis_lsp_iterate_ip_reach(struct isis_lsp *lsp, int family, uint16_t mtid,
+ lsp_ip_reach_iter_cb cb, void *arg);
+int isis_lsp_iterate_is_reach(struct isis_lsp *lsp, uint16_t mtid,
+ lsp_is_reach_iter_cb cb, void *arg);
+
#define lsp_flood(lsp, circuit) \
_lsp_flood((lsp), (circuit), __func__, __FILE__, __LINE__)
void _lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit,