isis_constants.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef ISIS_CONSTANTS_H
  22. #define ISIS_CONSTANTS_H
  23. /*
  24. * Architectural constant values from p. 35 of ISO/IEC 10589
  25. */
  26. #define MAX_NARROW_LINK_METRIC 63
  27. #define MAX_NARROW_PATH_METRIC 1023
  28. #define MAX_WIDE_LINK_METRIC 0x00FFFFFF /* RFC4444 */
  29. #define MAX_WIDE_PATH_METRIC 0xFE000000 /* RFC3787 */
  30. #define ISO_SAP 0xFE
  31. #define INTRADOMAIN_ROUTEING_SELECTOR 0
  32. #define SEQUENCE_MODULUS 4294967296
  33. /*
  34. * implementation specific jitter values
  35. */
  36. #define IIH_JITTER 10 /* % */
  37. #define MAX_AGE_JITTER 5 /* % */
  38. #define MAX_LSP_GEN_JITTER 5 /* % */
  39. #define CSNP_JITTER 10 /* % */
  40. #define PSNP_JITTER 10 /* % */
  41. #define RANDOM_SPREAD 100000.0
  42. #define ISIS_LEVELS 2
  43. #define ISIS_LEVEL1 1
  44. #define ISIS_LEVEL2 2
  45. /*
  46. * Default values
  47. * ISO - 10589 Section 7.3.21 - Parameters
  48. * RFC 4444
  49. */
  50. #define MAX_AGE 1200
  51. #define ZERO_AGE_LIFETIME 60
  52. #define MIN_LSP_LIFETIME 350
  53. #define MAX_LSP_LIFETIME 65535
  54. #define DEFAULT_LSP_LIFETIME 1200
  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. #define MIN_MIN_LSP_GEN_INTERVAL 1
  59. #define MAX_MIN_LSP_GEN_INTERVAL 120 /* RFC 4444 says 65535 */
  60. #define DEFAULT_MIN_LSP_GEN_INTERVAL 30
  61. #define MIN_LSP_TRANS_INTERVAL 5
  62. #define MIN_CSNP_INTERVAL 1
  63. #define MAX_CSNP_INTERVAL 600
  64. #define DEFAULT_CSNP_INTERVAL 10
  65. #define MIN_PSNP_INTERVAL 1
  66. #define MAX_PSNP_INTERVAL 120
  67. #define DEFAULT_PSNP_INTERVAL 2
  68. #define MIN_HELLO_INTERVAL 1
  69. #define MAX_HELLO_INTERVAL 600
  70. #define DEFAULT_HELLO_INTERVAL 3
  71. #define MIN_HELLO_MULTIPLIER 2
  72. #define MAX_HELLO_MULTIPLIER 100
  73. #define DEFAULT_HELLO_MULTIPLIER 10
  74. #define MIN_PRIORITY 0
  75. #define MAX_PRIORITY 127
  76. #define DEFAULT_PRIORITY 64
  77. /* min and max metric varies by new vs old metric types */
  78. #define DEFAULT_CIRCUIT_METRIC 10
  79. #define METRICS_UNSUPPORTED 0x80
  80. #define MINIMUM_SPF_INTERVAL 1
  81. #define ISIS_MAX_PATH_SPLITS 64
  82. /*
  83. * NLPID values
  84. */
  85. #define NLPID_IP 204
  86. #define NLPID_IPV6 142
  87. #define NLPID_SNAP 128
  88. #define NLPID_CLNP 129
  89. #define NLPID_ESIS 130
  90. /*
  91. * Return values for functions
  92. */
  93. #define ISIS_OK 0
  94. #define ISIS_WARNING 1
  95. #define ISIS_ERROR 2
  96. #define ISIS_CRITICAL 3
  97. /*
  98. * IS-IS Circuit Types
  99. */
  100. #define IS_LEVEL_1 1
  101. #define IS_LEVEL_2 2
  102. #define IS_LEVEL_1_AND_2 3
  103. #define SNPA_ADDRSTRLEN 18
  104. #define ISIS_SYS_ID_LEN 6
  105. #define ISIS_NSEL_LEN 1
  106. #define SYSID_STRLEN 24
  107. /*
  108. * LSP bit masks
  109. */
  110. #define LSPBIT_P 0x80
  111. #define LSPBIT_ATT 0x78
  112. #define LSPBIT_OL 0x04
  113. #define LSPBIT_IST 0x03
  114. /*
  115. * LSP bit masking macros
  116. * taken from tcpdumps
  117. * print-isoclns.c
  118. */
  119. #define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
  120. #define ISIS_MASK_LSP_IS_L1_BIT(x) ((x)&0x1)
  121. #define ISIS_MASK_LSP_IS_L2_BIT(x) ((x)&0x2)
  122. #define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
  123. #define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
  124. #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
  125. #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
  126. #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
  127. #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
  128. #define LLC_LEN 3
  129. /* we need to be aware of the fact we are using ISO sized
  130. * packets, using isomtu = mtu - LLC_LEN
  131. */
  132. #define ISO_MTU(C) \
  133. ((if_is_broadcast ((C)->interface)) ? \
  134. (C->interface->mtu - LLC_LEN) : (C->interface->mtu))
  135. #ifndef ETH_ALEN
  136. #define ETH_ALEN 6
  137. #endif
  138. #endif /* ISIS_CONSTANTS_H */