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_LINK_METRIC               63
31 #define MAX_PATH_METRIC               1023
32 #define ISO_SAP                       0xFE
33 #define INTRADOMAIN_ROUTEING_SELECTOR 0
34 #define SEQUENCE_MODULUS              4294967296
35 #define RECEIVE_LSP_BUFFER_SIZE       1492
36 
37 /*
38  * implementation specific jitter values
39  */
40 
41 #define IIH_JITTER                    25	/* % */
42 #define MAX_AGE_JITTER                 5	/* % */
43 #define MAX_LSP_GEN_JITTER             5	/* % */
44 #define CSNP_JITTER                   10	/* % */
45 #define PSNP_JITTER                   10	/* % */
46 
47 #define RANDOM_SPREAD           100000.0
48 
49 /*
50  * Default values
51  * ISO - 10589
52  * Section 7.3.21 - Parameters
53  */
54 #define MAX_AGE                       1200
55 #define ZERO_AGE_LIFETIME             60
56 #define MAX_LSP_GEN_INTERVAL          900
57 #define MIN_LSP_GEN_INTERVAL          30
58 #define MIN_LSP_TRANS_INTERVAL        5
59 #define ISIS_MIN_LSP_LIFETIME         380
60 #define CSNP_INTERVAL                 10
61 #define PSNP_INTERVAL                 2
62 #define ISIS_MAX_PATH_SPLITS          3
63 
64 #define ISIS_LEVELS                   2
65 #define ISIS_LEVEL1                   1
66 #define ISIS_LEVEL2                   2
67 
68 #define HELLO_INTERVAL                10
69 #define HELLO_MINIMAL HELLO_INTERVAL
70 #define HELLO_MULTIPLIER              3
71 #define DEFAULT_PRIORITY              64
72 /* different vendors implement different values 5-10 on average */
73 #define LSP_GEN_INTERVAL_DEFAULT      10
74 #define LSP_INTERVAL                  33	/* msecs */
75 #define DEFAULT_CIRCUIT_METRICS 10
76 #define METRICS_UNSUPPORTED 0x80
77 #define PERIODIC_SPF_INTERVAL         60	/* at the top of my head */
78 #define MINIMUM_SPF_INTERVAL           5	/* .. same here          */
79 
80 /*
81  * NLPID values
82  */
83 #define NLPID_IP   204
84 #define NLPID_IPV6 142
85 #define NLPID_SNAP 128
86 #define NLPID_CLNP 129
87 #define NLPID_ESIS 130
88 
89 /*
90  * Return values for functions
91  */
92 #define ISIS_OK       0
93 #define ISIS_WARNING  1
94 #define ISIS_ERROR    2
95 #define ISIS_CRITICAL 3
96 
97 /*
98  * IS-IS Circuit Types
99  */
100 
101 #define IS_LEVEL_1       1
102 #define IS_LEVEL_2       2
103 #define IS_LEVEL_1_AND_2 3
104 
105 #define SNPA_ADDRSTRLEN 18
106 #define ISIS_SYS_ID_LEN  6
107 #define SYSID_STRLEN    24
108 
109 /*
110  * LSP bit masks
111  */
112 #define LSPBIT_P   0x80
113 #define LSPBIT_ATT 0x78
114 #define LSPBIT_OL  0x04
115 #define LSPBIT_IST 0x03
116 
117 /*
118  * LSP bit masking macros
119  * taken from tcpdumps
120  * print-isoclns.c
121  */
122 
123 #define ISIS_MASK_LSP_OL_BIT(x)            ((x)&0x4)
124 #define ISIS_MASK_LSP_IS_L1_BIT(x)         ((x)&0x1)
125 #define ISIS_MASK_LSP_IS_L2_BIT(x)         ((x)&0x2)
126 #define ISIS_MASK_LSP_PARTITION_BIT(x)     ((x)&0x80)
127 #define ISIS_MASK_LSP_ATT_BITS(x)          ((x)&0x78)
128 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x)     ((x)&0x40)
129 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x)   ((x)&0x20)
130 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x)     ((x)&0x10)
131 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x)   ((x)&0x8)
132 
133 #define LLC_LEN 3
134 
135 /* we need to be aware of the fact we are using ISO sized
136  * packets, using isomtu = mtu - LLC_LEN
137  */
138 #define ISO_MTU(C) \
139           (C->circ_type==CIRCUIT_T_BROADCAST) ? \
140           (C->interface->mtu - LLC_LEN) : (C->interface->mtu)
141 
142 #ifndef ETH_ALEN
143 #define ETH_ALEN 6
144 #endif
145 
146 #endif /* _ISIS_CONSTANTS_H_ */
147