]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_lsp.h
Merge pull request #3363 from pacovn/static_analysis__ISO_C_return_compliance
[mirror_frr.git] / isisd / isis_lsp.h
CommitLineData
eb5d44eb 1/*
d62a17ae 2 * IS-IS Rout(e)ing protocol - isis_lsp.h
eb5d44eb 3 * LSP processing
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
8 *
d62a17ae 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)
eb5d44eb 12 * any later version.
13 *
d62a17ae 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
eb5d44eb 17 * more details.
896014f4
DL
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
eb5d44eb 22 */
23
24#ifndef _ZEBRA_ISIS_LSP_H
25#define _ZEBRA_ISIS_LSP_H
26
af8ac8f9
CF
27#include "isisd/isis_pdu.h"
28
eb5d44eb 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 */
d62a17ae 33struct isis_lsp {
af8ac8f9
CF
34 struct isis_lsp_hdr hdr;
35 struct stream *pdu; /* full pdu lsp */
d62a17ae 36 union {
37 struct list *frags;
38 struct isis_lsp *zero_lsp;
39 } lspu;
d7c0a89a 40 uint32_t SSNflags[ISIS_MAX_CIRCUITS];
d62a17ae 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;
af8ac8f9 49 struct isis_tlvs *tlvs;
eb5d44eb 50};
51
d62a17ae 52dict_t *lsp_db_init(void);
53void lsp_db_destroy(dict_t *lspdb);
54int lsp_tick(struct thread *thread);
eb5d44eb 55
d62a17ae 56int lsp_generate(struct isis_area *area, int level);
691f3e76 57#define lsp_regenerate_schedule(area, level, all_pseudo) \
f93025e1 58 _lsp_regenerate_schedule((area), (level), (all_pseudo), true, \
691f3e76
CF
59 __func__, __FILE__, __LINE__)
60int _lsp_regenerate_schedule(struct isis_area *area, int level,
f93025e1
CF
61 int all_pseudo, bool postpone,
62 const char *func, const char *file, int line);
d62a17ae 63int lsp_generate_pseudo(struct isis_circuit *circuit, int level);
64int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level);
eb5d44eb 65
af8ac8f9
CF
66struct isis_lsp *lsp_new(struct isis_area *area, uint8_t *lsp_id,
67 uint16_t rem_lifetime, uint32_t seq_num,
8f5dbe18
CF
68 uint8_t lsp_bits, uint16_t checksum,
69 struct isis_lsp *lsp0, int level);
af8ac8f9
CF
70struct isis_lsp *lsp_new_from_recv(struct isis_lsp_hdr *hdr,
71 struct isis_tlvs *tlvs,
72 struct stream *stream, struct isis_lsp *lsp0,
73 struct isis_area *area, int level);
d62a17ae 74void lsp_insert(struct isis_lsp *lsp, dict_t *lspdb);
d7c0a89a 75struct isis_lsp *lsp_search(uint8_t *id, dict_t *lspdb);
eb5d44eb 76
d7c0a89a 77void lsp_build_list(uint8_t *start_id, uint8_t *stop_id, uint8_t num_lsps,
d62a17ae 78 struct list *list, dict_t *lspdb);
d7c0a89a 79void lsp_build_list_nonzero_ht(uint8_t *start_id, uint8_t *stop_id,
d62a17ae 80 struct list *list, dict_t *lspdb);
d7c0a89a
QY
81void lsp_search_and_destroy(uint8_t *id, dict_t *lspdb);
82void lsp_purge_pseudo(uint8_t *id, struct isis_circuit *circuit, int level);
af8ac8f9 83void lsp_purge_non_exist(int level, struct isis_lsp_hdr *hdr,
d62a17ae 84 struct isis_area *area);
eb5d44eb 85
86#define LSP_EQUAL 1
87#define LSP_NEWER 2
88#define LSP_OLDER 3
89
c83dcd3f 90#define LSP_PSEUDO_ID(I) ((I)[ISIS_SYS_ID_LEN])
91#define LSP_FRAGMENT(I) ((I)[ISIS_SYS_ID_LEN + 1])
d62a17ae 92#define OWNLSPID(I) \
93 memcpy((I), isis->sysid, ISIS_SYS_ID_LEN); \
94 (I)[ISIS_SYS_ID_LEN] = 0; \
95 (I)[ISIS_SYS_ID_LEN + 1] = 0
d7c0a89a 96int lsp_id_cmp(uint8_t *id1, uint8_t *id2);
af8ac8f9
CF
97int lsp_compare(char *areatag, struct isis_lsp *lsp, uint32_t seqno,
98 uint16_t checksum, uint16_t rem_lifetime);
99void lsp_update(struct isis_lsp *lsp, struct isis_lsp_hdr *hdr,
100 struct isis_tlvs *tlvs, struct stream *stream,
164066e4 101 struct isis_area *area, int level, bool confusion);
af8ac8f9 102void lsp_inc_seqno(struct isis_lsp *lsp, uint32_t seqno);
d62a17ae 103void lsp_print(struct isis_lsp *lsp, struct vty *vty, char dynhost);
104void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost);
105int lsp_print_all(struct vty *vty, dict_t *lspdb, char detail, char dynhost);
3f045a08 106/* sets SRMflags for all active circuits of an lsp */
9b39405f
CF
107void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set);
108void lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit);
a5b5e946 109void lsp_init(void);
3f045a08 110
eb5d44eb 111#endif /* ISIS_LSP */