]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_constants.h
isisd: Convert to using prefix.h ETH_ALEN
[mirror_frr.git] / isisd / isis_constants.h
CommitLineData
eb5d44eb 1/*
d62a17ae 2 * IS-IS Rout(e)ing protocol - isis_constants.h
eb5d44eb 3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 5 * Tampere University of Technology
eb5d44eb 6 * Institute of Communications Engineering
7 *
d62a17ae 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
eb5d44eb 11 * any later version.
12 *
d62a17ae 13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb5d44eb 16 * more details.
896014f4
DL
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eb5d44eb 21 */
22
23#ifndef ISIS_CONSTANTS_H
24#define ISIS_CONSTANTS_H
25
26/*
27 * Architectural constant values from p. 35 of ISO/IEC 10589
f390d2c7 28 */
eb5d44eb 29
3f045a08
JB
30#define MAX_NARROW_LINK_METRIC 63
31#define MAX_NARROW_PATH_METRIC 1023
32#define MAX_WIDE_LINK_METRIC 0x00FFFFFF /* RFC4444 */
33#define MAX_WIDE_PATH_METRIC 0xFE000000 /* RFC3787 */
eb5d44eb 34#define ISO_SAP 0xFE
35#define INTRADOMAIN_ROUTEING_SELECTOR 0
36#define SEQUENCE_MODULUS 4294967296
eb5d44eb 37
3c3877cd
DL
38#define ISO9542_ESIS 0x82
39#define ISO10589_ISIS 0x83
40
eb5d44eb 41/*
42 * implementation specific jitter values
43 */
44
3f045a08 45#define IIH_JITTER 10 /* % */
f390d2c7 46#define MAX_AGE_JITTER 5 /* % */
47#define MAX_LSP_GEN_JITTER 5 /* % */
48#define CSNP_JITTER 10 /* % */
49#define PSNP_JITTER 10 /* % */
eb5d44eb 50
51#define RANDOM_SPREAD 100000.0
52
3f045a08
JB
53#define ISIS_LEVELS 2
54#define ISIS_LEVEL1 1
55#define ISIS_LEVEL2 2
56
eb5d44eb 57/*
58 * Default values
3f045a08
JB
59 * ISO - 10589 Section 7.3.21 - Parameters
60 * RFC 4444
eb5d44eb 61 */
62#define MAX_AGE 1200
63#define ZERO_AGE_LIFETIME 60
3f045a08
JB
64#define MIN_LSP_LIFETIME 350
65#define MAX_LSP_LIFETIME 65535
66#define DEFAULT_LSP_LIFETIME 1200
67
68#define MIN_MAX_LSP_GEN_INTERVAL 1
69#define MAX_MAX_LSP_GEN_INTERVAL 65235
70#define DEFAULT_MAX_LSP_GEN_INTERVAL 900
71
72#define MIN_MIN_LSP_GEN_INTERVAL 1
73#define MAX_MIN_LSP_GEN_INTERVAL 120 /* RFC 4444 says 65535 */
74#define DEFAULT_MIN_LSP_GEN_INTERVAL 30
75
eb5d44eb 76#define MIN_LSP_TRANS_INTERVAL 5
eb5d44eb 77
3f045a08
JB
78#define MIN_CSNP_INTERVAL 1
79#define MAX_CSNP_INTERVAL 600
80#define DEFAULT_CSNP_INTERVAL 10
81
82#define MIN_PSNP_INTERVAL 1
83#define MAX_PSNP_INTERVAL 120
84#define DEFAULT_PSNP_INTERVAL 2
85
86#define MIN_HELLO_INTERVAL 1
87#define MAX_HELLO_INTERVAL 600
88#define DEFAULT_HELLO_INTERVAL 3
89
90#define MIN_HELLO_MULTIPLIER 2
91#define MAX_HELLO_MULTIPLIER 100
92#define DEFAULT_HELLO_MULTIPLIER 10
eb5d44eb 93
3f045a08
JB
94#define MIN_PRIORITY 0
95#define MAX_PRIORITY 127
eb5d44eb 96#define DEFAULT_PRIORITY 64
3f045a08
JB
97
98/* min and max metric varies by new vs old metric types */
99#define DEFAULT_CIRCUIT_METRIC 10
100
101#define METRICS_UNSUPPORTED 0x80
102
103#define MINIMUM_SPF_INTERVAL 1
104
105#define ISIS_MAX_PATH_SPLITS 64
eb5d44eb 106
107/*
108 * NLPID values
109 */
110#define NLPID_IP 204
111#define NLPID_IPV6 142
2097cd8a 112#define NLPID_SNAP 128
113#define NLPID_CLNP 129
114#define NLPID_ESIS 130
eb5d44eb 115
116/*
117 * Return values for functions
118 */
119#define ISIS_OK 0
120#define ISIS_WARNING 1
121#define ISIS_ERROR 2
122#define ISIS_CRITICAL 3
123
124/*
125 * IS-IS Circuit Types
126 */
127
128#define IS_LEVEL_1 1
129#define IS_LEVEL_2 2
130#define IS_LEVEL_1_AND_2 3
131
132#define SNPA_ADDRSTRLEN 18
133#define ISIS_SYS_ID_LEN 6
3f045a08 134#define ISIS_NSEL_LEN 1
eb5d44eb 135#define SYSID_STRLEN 24
136
137/*
138 * LSP bit masks
139 */
140#define LSPBIT_P 0x80
141#define LSPBIT_ATT 0x78
142#define LSPBIT_OL 0x04
143#define LSPBIT_IST 0x03
144
145/*
146 * LSP bit masking macros
147 * taken from tcpdumps
148 * print-isoclns.c
149 */
150
151#define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
152#define ISIS_MASK_LSP_IS_L1_BIT(x) ((x)&0x1)
153#define ISIS_MASK_LSP_IS_L2_BIT(x) ((x)&0x2)
154#define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
155#define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
156#define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
157#define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
158#define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
159#define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
160
161#define LLC_LEN 3
162
163/* we need to be aware of the fact we are using ISO sized
164 * packets, using isomtu = mtu - LLC_LEN
165 */
d62a17ae 166#define ISO_MTU(C) \
167 ((if_is_broadcast((C)->interface)) ? (C->interface->mtu - LLC_LEN) \
168 : (C->interface->mtu))
eb5d44eb 169
316a98ec
CF
170#define MAX_LLC_LEN 0x5ff
171#define ETHERTYPE_EXT_LLC 0x8870
172
173static inline uint16_t isis_ethertype(size_t len)
174{
d62a17ae 175 if (len > MAX_LLC_LEN)
176 return ETHERTYPE_EXT_LLC;
177 return len;
316a98ec
CF
178}
179
f390d2c7 180#endif /* ISIS_CONSTANTS_H */