2 * IS-IS Rout(e)ing protocol - isis_lsp.h
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
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)
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
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef _ZEBRA_ISIS_LSP_H
25 #define _ZEBRA_ISIS_LSP_H
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 */
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 */
39 struct isis_lsp
*zero_lsp
;
41 u_int32_t auth_tlv_offset
; /* authentication TLV position in the pdu */
42 u_int32_t SRMflags
[ISIS_MAX_CIRCUITS
];
43 u_int32_t SSNflags
[ISIS_MAX_CIRCUITS
];
44 int level
; /* L1 or L2? */
45 int scheduled
; /* scheduled for sending */
47 time_t last_generated
;
49 #ifdef TOPOLOGY_GENERATE
51 struct thread
*t_lsp_top_ref
;
53 /* used for 60 second counting when rem_lifetime is zero */
55 struct isis_area
*area
;
56 struct tlvs tlv_data
; /* Simplifies TLV access */
59 dict_t
*lsp_db_init (void);
60 void lsp_db_destroy (dict_t
* lspdb
);
61 int lsp_tick (struct thread
*thread
);
63 int lsp_generate (struct isis_area
*area
, int level
);
64 int lsp_regenerate_schedule (struct isis_area
*area
, int level
,
66 int lsp_generate_pseudo (struct isis_circuit
*circuit
, int level
);
67 int lsp_regenerate_schedule_pseudo (struct isis_circuit
*circuit
, int level
);
69 struct isis_lsp
*lsp_new (struct isis_area
*area
, u_char
* lsp_id
,
70 u_int16_t rem_lifetime
,
71 u_int32_t seq_num
, u_int8_t lsp_bits
,
72 u_int16_t checksum
, int level
);
73 struct isis_lsp
*lsp_new_from_stream_ptr (struct stream
*stream
,
75 struct isis_lsp
*lsp0
,
76 struct isis_area
*area
,
78 void lsp_insert (struct isis_lsp
*lsp
, dict_t
* lspdb
);
79 struct isis_lsp
*lsp_search (u_char
* id
, dict_t
* lspdb
);
81 void lsp_build_list (u_char
* start_id
, u_char
* stop_id
, u_char num_lsps
,
82 struct list
*list
, dict_t
* lspdb
);
83 void lsp_build_list_nonzero_ht (u_char
* start_id
, u_char
* stop_id
,
84 struct list
*list
, dict_t
* lspdb
);
85 void lsp_build_list_ssn (struct isis_circuit
*circuit
, u_char num_lsps
,
86 struct list
*list
, dict_t
* lspdb
);
88 void lsp_search_and_destroy (u_char
* id
, dict_t
* lspdb
);
89 void lsp_purge_pseudo (u_char
* id
, struct isis_circuit
*circuit
, int level
);
90 void lsp_purge_non_exist (int level
,
91 struct isis_link_state_hdr
*lsp_hdr
,
92 struct isis_area
*area
);
98 #define LSP_PSEUDO_ID(I) ((I)[ISIS_SYS_ID_LEN])
99 #define LSP_FRAGMENT(I) ((I)[ISIS_SYS_ID_LEN + 1])
100 #define OWNLSPID(I) \
101 memcpy ((I), isis->sysid, ISIS_SYS_ID_LEN);\
102 (I)[ISIS_SYS_ID_LEN] = 0;\
103 (I)[ISIS_SYS_ID_LEN + 1] = 0
104 int lsp_id_cmp (u_char
* id1
, u_char
* id2
);
105 int lsp_compare (char *areatag
, struct isis_lsp
*lsp
, u_int32_t seq_num
,
106 u_int16_t checksum
, u_int16_t rem_lifetime
);
107 void lsp_update (struct isis_lsp
*lsp
, struct stream
*stream
,
108 struct isis_area
*area
, int level
);
109 void lsp_inc_seqnum (struct isis_lsp
*lsp
, u_int32_t seq_num
);
110 void lsp_print (struct isis_lsp
*lsp
, struct vty
*vty
, char dynhost
);
111 void lsp_print_detail (struct isis_lsp
*lsp
, struct vty
*vty
, char dynhost
);
112 int lsp_print_all (struct vty
*vty
, dict_t
* lspdb
, char detail
,
114 const char *lsp_bits2string (u_char
*);
116 /* sets SRMflags for all active circuits of an lsp */
117 void lsp_set_all_srmflags (struct isis_lsp
*lsp
);
119 #ifdef TOPOLOGY_GENERATE
120 void generate_topology_lsps (struct isis_area
*area
);
121 void remove_topology_lsps (struct isis_area
*area
);
122 void build_topology_lsp_data (struct isis_lsp
*lsp
,
123 struct isis_area
*area
, int lsp_top_num
);
124 #endif /* TOPOLOGY_GENERATE */
126 #endif /* ISIS_LSP */