]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_constants.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / isisd / isis_constants.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
eb5d44eb 2/*
d62a17ae 3 * IS-IS Rout(e)ing protocol - isis_constants.h
eb5d44eb 4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
eb5d44eb 8 */
9
10#ifndef ISIS_CONSTANTS_H
11#define ISIS_CONSTANTS_H
12
13/*
14 * Architectural constant values from p. 35 of ISO/IEC 10589
f390d2c7 15 */
eb5d44eb 16
3f045a08
JB
17#define MAX_NARROW_LINK_METRIC 63
18#define MAX_NARROW_PATH_METRIC 1023
19#define MAX_WIDE_LINK_METRIC 0x00FFFFFF /* RFC4444 */
20#define MAX_WIDE_PATH_METRIC 0xFE000000 /* RFC3787 */
eb5d44eb 21#define ISO_SAP 0xFE
22#define INTRADOMAIN_ROUTEING_SELECTOR 0
23#define SEQUENCE_MODULUS 4294967296
eb5d44eb 24
3c3877cd
DL
25#define ISO9542_ESIS 0x82
26#define ISO10589_ISIS 0x83
27
eb5d44eb 28/*
29 * implementation specific jitter values
30 */
31
3f045a08 32#define IIH_JITTER 10 /* % */
f390d2c7 33#define MAX_AGE_JITTER 5 /* % */
34#define MAX_LSP_GEN_JITTER 5 /* % */
35#define CSNP_JITTER 10 /* % */
36#define PSNP_JITTER 10 /* % */
eb5d44eb 37
38#define RANDOM_SPREAD 100000.0
39
3f045a08
JB
40#define ISIS_LEVELS 2
41#define ISIS_LEVEL1 1
42#define ISIS_LEVEL2 2
43
eb5d44eb 44/*
45 * Default values
3f045a08
JB
46 * ISO - 10589 Section 7.3.21 - Parameters
47 * RFC 4444
eb5d44eb 48 */
49#define MAX_AGE 1200
50#define ZERO_AGE_LIFETIME 60
3f045a08
JB
51#define MIN_LSP_LIFETIME 350
52#define MAX_LSP_LIFETIME 65535
53#define DEFAULT_LSP_LIFETIME 1200
54
55#define MIN_MAX_LSP_GEN_INTERVAL 1
56#define MAX_MAX_LSP_GEN_INTERVAL 65235
57#define DEFAULT_MAX_LSP_GEN_INTERVAL 900
58
59#define MIN_MIN_LSP_GEN_INTERVAL 1
60#define MAX_MIN_LSP_GEN_INTERVAL 120 /* RFC 4444 says 65535 */
61#define DEFAULT_MIN_LSP_GEN_INTERVAL 30
62
e5973ce5 63#define MIN_LSP_RETRANS_INTERVAL 5 /* Seconds */
eb5d44eb 64
a0a707ee
CF
65#define TRIGGERED_IIH_DELAY 50 /* msec */
66
3f045a08
JB
67#define MIN_CSNP_INTERVAL 1
68#define MAX_CSNP_INTERVAL 600
69#define DEFAULT_CSNP_INTERVAL 10
70
71#define MIN_PSNP_INTERVAL 1
72#define MAX_PSNP_INTERVAL 120
73#define DEFAULT_PSNP_INTERVAL 2
74
75#define MIN_HELLO_INTERVAL 1
76#define MAX_HELLO_INTERVAL 600
77#define DEFAULT_HELLO_INTERVAL 3
78
79#define MIN_HELLO_MULTIPLIER 2
80#define MAX_HELLO_MULTIPLIER 100
81#define DEFAULT_HELLO_MULTIPLIER 10
eb5d44eb 82
3f045a08
JB
83#define MIN_PRIORITY 0
84#define MAX_PRIORITY 127
eb5d44eb 85#define DEFAULT_PRIORITY 64
3f045a08
JB
86
87/* min and max metric varies by new vs old metric types */
88#define DEFAULT_CIRCUIT_METRIC 10
89
90#define METRICS_UNSUPPORTED 0x80
91
92#define MINIMUM_SPF_INTERVAL 1
93
94#define ISIS_MAX_PATH_SPLITS 64
eb5d44eb 95
96/*
97 * NLPID values
98 */
99#define NLPID_IP 204
100#define NLPID_IPV6 142
2097cd8a 101#define NLPID_SNAP 128
102#define NLPID_CLNP 129
103#define NLPID_ESIS 130
eb5d44eb 104
105/*
106 * Return values for functions
107 */
108#define ISIS_OK 0
109#define ISIS_WARNING 1
110#define ISIS_ERROR 2
111#define ISIS_CRITICAL 3
112
113/*
114 * IS-IS Circuit Types
115 */
116
117#define IS_LEVEL_1 1
118#define IS_LEVEL_2 2
119#define IS_LEVEL_1_AND_2 3
120
121#define SNPA_ADDRSTRLEN 18
122#define ISIS_SYS_ID_LEN 6
3f045a08 123#define ISIS_NSEL_LEN 1
eb5d44eb 124#define SYSID_STRLEN 24
125
126/*
127 * LSP bit masks
128 */
129#define LSPBIT_P 0x80
f3abc412 130#define LSPBIT_ATT 0x08 /* only use the Default ATT bit */
eb5d44eb 131#define LSPBIT_OL 0x04
132#define LSPBIT_IST 0x03
133
134/*
135 * LSP bit masking macros
136 * taken from tcpdumps
137 * print-isoclns.c
138 */
139
140#define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
141#define ISIS_MASK_LSP_IS_L1_BIT(x) ((x)&0x1)
142#define ISIS_MASK_LSP_IS_L2_BIT(x) ((x)&0x2)
143#define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
144#define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
145#define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
146#define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
147#define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
eb5d44eb 148
149#define LLC_LEN 3
150
151/* we need to be aware of the fact we are using ISO sized
152 * packets, using isomtu = mtu - LLC_LEN
153 */
d62a17ae 154#define ISO_MTU(C) \
155 ((if_is_broadcast((C)->interface)) ? (C->interface->mtu - LLC_LEN) \
156 : (C->interface->mtu))
eb5d44eb 157
316a98ec
CF
158#define MAX_LLC_LEN 0x5ff
159#define ETHERTYPE_EXT_LLC 0x8870
160
161static inline uint16_t isis_ethertype(size_t len)
162{
d62a17ae 163 if (len > MAX_LLC_LEN)
164 return ETHERTYPE_EXT_LLC;
165 return len;
316a98ec
CF
166}
167
f390d2c7 168#endif /* ISIS_CONSTANTS_H */