]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_lsp.h
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / isisd / isis_lsp.h
CommitLineData
eb5d44eb 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.
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
eb5d44eb 27/* Structure for isis_lsp, this structure will only support the fixed
28 * System ID (Currently 6) (atleast for now). In order to support more
29 * We will have to split the header into two parts, and for readability
30 * sake it should better be avoided */
31struct isis_lsp
32{
f390d2c7 33 struct isis_fixed_hdr *isis_header; /* normally equals pdu */
34 struct isis_link_state_hdr *lsp_header; /* pdu + isis_header_len */
35 struct stream *pdu; /* full pdu lsp */
36 union
37 {
eb5d44eb 38 struct list *frags;
39 struct isis_lsp *zero_lsp;
40 } lspu;
3f045a08 41 u_int32_t auth_tlv_offset; /* authentication TLV position in the pdu */
eb5d44eb 42 u_int32_t SRMflags[ISIS_MAX_CIRCUITS];
43 u_int32_t SSNflags[ISIS_MAX_CIRCUITS];
f390d2c7 44 int level; /* L1 or L2? */
f390d2c7 45 int scheduled; /* scheduled for sending */
eb5d44eb 46 time_t installed;
47 time_t last_generated;
eb5d44eb 48 int own_lsp;
eb5d44eb 49 /* used for 60 second counting when rem_lifetime is zero */
f390d2c7 50 int age_out;
f1082d19 51 struct isis_area *area;
f390d2c7 52 struct tlvs tlv_data; /* Simplifies TLV access */
eb5d44eb 53};
54
55dict_t *lsp_db_init (void);
f390d2c7 56void lsp_db_destroy (dict_t * lspdb);
eb5d44eb 57int lsp_tick (struct thread *thread);
58
3f045a08
JB
59int lsp_generate (struct isis_area *area, int level);
60int lsp_regenerate_schedule (struct isis_area *area, int level,
61 int all_pseudo);
62int lsp_generate_pseudo (struct isis_circuit *circuit, int level);
63int lsp_regenerate_schedule_pseudo (struct isis_circuit *circuit, int level);
eb5d44eb 64
b20ccb3a
CF
65struct isis_lsp *lsp_new (struct isis_area *area, u_char * lsp_id,
66 u_int16_t rem_lifetime,
f390d2c7 67 u_int32_t seq_num, u_int8_t lsp_bits,
68 u_int16_t checksum, int level);
69struct isis_lsp *lsp_new_from_stream_ptr (struct stream *stream,
70 u_int16_t pdu_len,
71 struct isis_lsp *lsp0,
3f045a08
JB
72 struct isis_area *area,
73 int level);
f390d2c7 74void lsp_insert (struct isis_lsp *lsp, dict_t * lspdb);
75struct isis_lsp *lsp_search (u_char * id, dict_t * lspdb);
eb5d44eb 76
3f045a08 77void lsp_build_list (u_char * start_id, u_char * stop_id, u_char num_lsps,
f390d2c7 78 struct list *list, dict_t * lspdb);
79void lsp_build_list_nonzero_ht (u_char * start_id, u_char * stop_id,
80 struct list *list, dict_t * lspdb);
3f045a08
JB
81void lsp_build_list_ssn (struct isis_circuit *circuit, u_char num_lsps,
82 struct list *list, dict_t * lspdb);
eb5d44eb 83
f390d2c7 84void lsp_search_and_destroy (u_char * id, dict_t * lspdb);
3f045a08 85void lsp_purge_pseudo (u_char * id, struct isis_circuit *circuit, int level);
17baea9c
CF
86void lsp_purge_non_exist (int level,
87 struct isis_link_state_hdr *lsp_hdr,
f390d2c7 88 struct isis_area *area);
eb5d44eb 89
90#define LSP_EQUAL 1
91#define LSP_NEWER 2
92#define LSP_OLDER 3
93
c83dcd3f 94#define LSP_PSEUDO_ID(I) ((I)[ISIS_SYS_ID_LEN])
95#define LSP_FRAGMENT(I) ((I)[ISIS_SYS_ID_LEN + 1])
eb5d44eb 96#define OWNLSPID(I) \
97 memcpy ((I), isis->sysid, ISIS_SYS_ID_LEN);\
98 (I)[ISIS_SYS_ID_LEN] = 0;\
99 (I)[ISIS_SYS_ID_LEN + 1] = 0
f390d2c7 100int lsp_id_cmp (u_char * id1, u_char * id2);
101int lsp_compare (char *areatag, struct isis_lsp *lsp, u_int32_t seq_num,
102 u_int16_t checksum, u_int16_t rem_lifetime);
3f045a08
JB
103void lsp_update (struct isis_lsp *lsp, struct stream *stream,
104 struct isis_area *area, int level);
eb5d44eb 105void lsp_inc_seqnum (struct isis_lsp *lsp, u_int32_t seq_num);
3f045a08
JB
106void lsp_print (struct isis_lsp *lsp, struct vty *vty, char dynhost);
107void lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost);
f390d2c7 108int lsp_print_all (struct vty *vty, dict_t * lspdb, char detail,
109 char dynhost);
1cd80845 110const char *lsp_bits2string (u_char *);
eb5d44eb 111
3f045a08
JB
112/* sets SRMflags for all active circuits of an lsp */
113void lsp_set_all_srmflags (struct isis_lsp *lsp);
114
eb5d44eb 115#endif /* ISIS_LSP */