New upstream release and new maintainer
[quagga-debian.git] / isisd / isis_constants.h
1 /*
2  * IS-IS Rout(e)ing protocol - isis_constants.h   
3  *
4  * Copyright (C) 2001,2002   Sampo Saaristo
5  *                           Tampere University of Technology      
6  *                           Institute of Communications Engineering
7  *
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) 
11  * any later version.
12  *
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 
16  * more details.
17
18  * You should have received a copy of the GNU General Public License along 
19  * with this program; if not, write to the Free Software Foundation, Inc., 
20  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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
28  */
29
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 */
34 #define ISO_SAP                       0xFE
35 #define INTRADOMAIN_ROUTEING_SELECTOR 0
36 #define SEQUENCE_MODULUS              4294967296
37
38 /*
39  * implementation specific jitter values
40  */
41
42 #define IIH_JITTER                    10        /* % */
43 #define MAX_AGE_JITTER                 5        /* % */
44 #define MAX_LSP_GEN_JITTER             5        /* % */
45 #define CSNP_JITTER                   10        /* % */
46 #define PSNP_JITTER                   10        /* % */
47
48 #define RANDOM_SPREAD           100000.0
49
50 #define ISIS_LEVELS                   2
51 #define ISIS_LEVEL1                   1
52 #define ISIS_LEVEL2                   2
53
54 /*
55  * Default values
56  * ISO - 10589 Section 7.3.21 - Parameters
57  * RFC 4444
58  */
59 #define MAX_AGE                       1200
60 #define ZERO_AGE_LIFETIME             60
61 #define MIN_LSP_LIFETIME              350
62 #define MAX_LSP_LIFETIME              65535
63 #define DEFAULT_LSP_LIFETIME          1200
64
65 #define MIN_MAX_LSP_GEN_INTERVAL      1
66 #define MAX_MAX_LSP_GEN_INTERVAL      65235
67 #define DEFAULT_MAX_LSP_GEN_INTERVAL  900
68
69 #define MIN_MIN_LSP_GEN_INTERVAL      1
70 #define MAX_MIN_LSP_GEN_INTERVAL      120  /* RFC 4444 says 65535 */
71 #define DEFAULT_MIN_LSP_GEN_INTERVAL  30
72
73 #define MIN_LSP_TRANS_INTERVAL        5
74
75 #define MIN_CSNP_INTERVAL             1
76 #define MAX_CSNP_INTERVAL             600
77 #define DEFAULT_CSNP_INTERVAL         10
78
79 #define MIN_PSNP_INTERVAL             1
80 #define MAX_PSNP_INTERVAL             120
81 #define DEFAULT_PSNP_INTERVAL         2
82
83 #define MIN_HELLO_INTERVAL            1
84 #define MAX_HELLO_INTERVAL            600
85 #define DEFAULT_HELLO_INTERVAL        3
86
87 #define MIN_HELLO_MULTIPLIER          2
88 #define MAX_HELLO_MULTIPLIER          100
89 #define DEFAULT_HELLO_MULTIPLIER      10
90
91 #define MIN_PRIORITY                  0
92 #define MAX_PRIORITY                  127
93 #define DEFAULT_PRIORITY              64
94
95 /* min and max metric varies by new vs old metric types */
96 #define DEFAULT_CIRCUIT_METRIC        10
97
98 #define METRICS_UNSUPPORTED           0x80
99
100 #define MINIMUM_SPF_INTERVAL          1
101
102 #define ISIS_MAX_PATH_SPLITS          64
103
104 /*
105  * NLPID values
106  */
107 #define NLPID_IP   204
108 #define NLPID_IPV6 142
109 #define NLPID_SNAP 128
110 #define NLPID_CLNP 129
111 #define NLPID_ESIS 130
112
113 /*
114  * Return values for functions
115  */
116 #define ISIS_OK       0
117 #define ISIS_WARNING  1
118 #define ISIS_ERROR    2
119 #define ISIS_CRITICAL 3
120
121 /*
122  * IS-IS Circuit Types
123  */
124
125 #define IS_LEVEL_1       1
126 #define IS_LEVEL_2       2
127 #define IS_LEVEL_1_AND_2 3
128
129 #define SNPA_ADDRSTRLEN 18
130 #define ISIS_SYS_ID_LEN  6
131 #define ISIS_NSEL_LEN    1
132 #define SYSID_STRLEN    24
133
134 /*
135  * LSP bit masks
136  */
137 #define LSPBIT_P   0x80
138 #define LSPBIT_ATT 0x78
139 #define LSPBIT_OL  0x04
140 #define LSPBIT_IST 0x03
141
142 /*
143  * LSP bit masking macros
144  * taken from tcpdumps
145  * print-isoclns.c
146  */
147
148 #define ISIS_MASK_LSP_OL_BIT(x)            ((x)&0x4)
149 #define ISIS_MASK_LSP_IS_L1_BIT(x)         ((x)&0x1)
150 #define ISIS_MASK_LSP_IS_L2_BIT(x)         ((x)&0x2)
151 #define ISIS_MASK_LSP_PARTITION_BIT(x)     ((x)&0x80)
152 #define ISIS_MASK_LSP_ATT_BITS(x)          ((x)&0x78)
153 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x)     ((x)&0x40)
154 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x)   ((x)&0x20)
155 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x)     ((x)&0x10)
156 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x)   ((x)&0x8)
157
158 #define LLC_LEN 3
159
160 /* we need to be aware of the fact we are using ISO sized
161  * packets, using isomtu = mtu - LLC_LEN
162  */
163 #define ISO_MTU(C) \
164           ((if_is_broadcast ((C)->interface)) ? \
165            (C->interface->mtu - LLC_LEN) : (C->interface->mtu))
166
167 #ifndef ETH_ALEN
168 #define ETH_ALEN 6
169 #endif
170
171 #endif /* ISIS_CONSTANTS_H */