]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_lsp.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / isisd / isis_lsp.h
1 /*
2 * IS-IS Rout(e)ing protocol - isis_lsp.h
3 * LSP processing
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef _ZEBRA_ISIS_LSP_H
25 #define _ZEBRA_ISIS_LSP_H
26
27 #include "isisd/isis_pdu.h"
28
29 /* Structure for isis_lsp, this structure will only support the fixed
30 * System ID (Currently 6) (atleast for now). In order to support more
31 * We will have to split the header into two parts, and for readability
32 * sake it should better be avoided */
33 struct isis_lsp {
34 struct isis_lsp_hdr hdr;
35 struct stream *pdu; /* full pdu lsp */
36 union {
37 struct list *frags;
38 struct isis_lsp *zero_lsp;
39 } lspu;
40 uint32_t SSNflags[ISIS_MAX_CIRCUITS];
41 int level; /* L1 or L2? */
42 int scheduled; /* scheduled for sending */
43 time_t installed;
44 time_t last_generated;
45 int own_lsp;
46 /* used for 60 second counting when rem_lifetime is zero */
47 int age_out;
48 struct isis_area *area;
49 struct isis_tlvs *tlvs;
50
51 time_t flooding_time;
52 struct list *flooding_neighbors[TX_LSP_CIRCUIT_SCOPED + 1];
53 char *flooding_interface;
54 bool flooding_circuit_scoped;
55 };
56
57 dict_t *lsp_db_init(void);
58 void lsp_db_destroy(dict_t *lspdb);
59 int lsp_tick(struct thread *thread);
60
61 int lsp_generate(struct isis_area *area, int level);
62 #define lsp_regenerate_schedule(area, level, all_pseudo) \
63 _lsp_regenerate_schedule((area), (level), (all_pseudo), true, \
64 __func__, __FILE__, __LINE__)
65 int _lsp_regenerate_schedule(struct isis_area *area, int level,
66 int all_pseudo, bool postpone,
67 const char *func, const char *file, int line);
68 int lsp_generate_pseudo(struct isis_circuit *circuit, int level);
69 int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level);
70
71 struct isis_lsp *lsp_new(struct isis_area *area, uint8_t *lsp_id,
72 uint16_t rem_lifetime, uint32_t seq_num,
73 uint8_t lsp_bits, uint16_t checksum,
74 struct isis_lsp *lsp0, int level);
75 struct isis_lsp *lsp_new_from_recv(struct isis_lsp_hdr *hdr,
76 struct isis_tlvs *tlvs,
77 struct stream *stream, struct isis_lsp *lsp0,
78 struct isis_area *area, int level);
79 void lsp_insert(struct isis_lsp *lsp, dict_t *lspdb);
80 struct isis_lsp *lsp_search(uint8_t *id, dict_t *lspdb);
81
82 void lsp_build_list(uint8_t *start_id, uint8_t *stop_id, uint8_t num_lsps,
83 struct list *list, dict_t *lspdb);
84 void lsp_build_list_nonzero_ht(uint8_t *start_id, uint8_t *stop_id,
85 struct list *list, dict_t *lspdb);
86 void lsp_search_and_destroy(uint8_t *id, dict_t *lspdb);
87 void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level);
88 void lsp_purge_non_exist(int level, struct isis_lsp_hdr *hdr,
89 struct isis_area *area);
90
91 #define LSP_EQUAL 1
92 #define LSP_NEWER 2
93 #define LSP_OLDER 3
94
95 #define LSP_PSEUDO_ID(I) ((I)[ISIS_SYS_ID_LEN])
96 #define LSP_FRAGMENT(I) ((I)[ISIS_SYS_ID_LEN + 1])
97 #define OWNLSPID(I) \
98 memcpy((I), isis->sysid, ISIS_SYS_ID_LEN); \
99 (I)[ISIS_SYS_ID_LEN] = 0; \
100 (I)[ISIS_SYS_ID_LEN + 1] = 0
101 int lsp_id_cmp(uint8_t *id1, uint8_t *id2);
102 int lsp_compare(char *areatag, struct isis_lsp *lsp, uint32_t seqno,
103 uint16_t checksum, uint16_t rem_lifetime);
104 void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
105 struct isis_tlvs *tlvs, struct stream *stream,
106 struct isis_area *area, int level, bool confusion);
107 void lsp_inc_seqno(struct isis_lsp *lsp, uint32_t seqno);
108 void lspid_print(uint8_t *lsp_id, char *dest, char dynhost, char frag);
109 void lsp_print(struct isis_lsp *lsp, struct vty *vty, char dynhost);
110 void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost);
111 int lsp_print_all(struct vty *vty, dict_t *lspdb, char detail, char dynhost);
112 /* sets SRMflags for all active circuits of an lsp */
113 void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set);
114
115 #define lsp_flood(lsp, circuit) \
116 _lsp_flood((lsp), (circuit), __func__, __FILE__, __LINE__)
117 void _lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit,
118 const char *func, const char *file, int line);
119 void lsp_init(void);
120
121 #endif /* ISIS_LSP */