isis_adjacency.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * IS-IS Rout(e)ing protocol - isis_adjacency.h
  3. * IS-IS adjacency handling
  4. *
  5. * Copyright (C) 2001,2002 Sampo Saaristo
  6. * Tampere University of Technology
  7. * Institute of Communications Engineering
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public Licenseas published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef _ZEBRA_ISIS_ADJACENCY_H
  24. #define _ZEBRA_ISIS_ADJACENCY_H
  25. enum isis_adj_usage
  26. {
  27. ISIS_ADJ_NONE,
  28. ISIS_ADJ_LEVEL1,
  29. ISIS_ADJ_LEVEL2,
  30. ISIS_ADJ_LEVEL1AND2
  31. };
  32. enum isis_system_type
  33. {
  34. ISIS_SYSTYPE_UNKNOWN,
  35. ISIS_SYSTYPE_ES,
  36. ISIS_SYSTYPE_IS,
  37. ISIS_SYSTYPE_L1_IS,
  38. ISIS_SYSTYPE_L2_IS
  39. };
  40. enum isis_adj_state
  41. {
  42. ISIS_ADJ_INITIALIZING,
  43. ISIS_ADJ_UP,
  44. ISIS_ADJ_DOWN
  45. };
  46. /*
  47. * we use the following codes to give an indication _why_
  48. * a specific adjacency is up or down
  49. */
  50. enum isis_adj_updown_reason
  51. {
  52. ISIS_ADJ_REASON_SEENSELF,
  53. ISIS_ADJ_REASON_AREA_MISMATCH,
  54. ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
  55. ISIS_ADJ_REASON_AUTH_FAILED,
  56. ISIS_ADJ_REASON_CHECKSUM_FAILED
  57. };
  58. #define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
  59. struct isis_dis_record
  60. {
  61. int dis; /* is our neighbor the DIS ? */
  62. time_t last_dis_change; /* timestamp for last dis change */
  63. };
  64. struct isis_adjacency
  65. {
  66. u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
  67. u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
  68. u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */
  69. int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */
  70. /* an array of N levels for M records */
  71. struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS];
  72. enum isis_adj_state adj_state; /* adjacencyState */
  73. enum isis_adj_usage adj_usage; /* adjacencyUsage */
  74. struct list *area_addrs; /* areaAdressesOfNeighbour */
  75. struct nlpids nlpids; /* protocols spoken ... */
  76. struct list *ipv4_addrs;
  77. #ifdef HAVE_IPV6
  78. struct list *ipv6_addrs;
  79. #endif /* HAVE_IPV6 */
  80. u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
  81. int circuit_t; /* from hello PDU hdr */
  82. int level; /* level (1 or 2) */
  83. enum isis_system_type sys_type; /* neighbourSystemType */
  84. u_int16_t hold_time; /* entryRemainingTime */
  85. u_int32_t last_upd;
  86. u_int32_t last_flap; /* last time the adj flapped */
  87. int flaps; /* number of adjacency flaps */
  88. struct thread *t_expire; /* expire after hold_time */
  89. struct isis_circuit *circuit; /* back pointer */
  90. };
  91. struct isis_adjacency *isis_adj_lookup (u_char * sysid, struct list *adjdb);
  92. struct isis_adjacency *isis_adj_lookup_snpa (u_char * ssnpa,
  93. struct list *adjdb);
  94. struct isis_adjacency *isis_new_adj (u_char * id, u_char * snpa, int level,
  95. struct isis_circuit *circuit);
  96. void isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb);
  97. void isis_adj_state_change (struct isis_adjacency *adj,
  98. enum isis_adj_state state, char *reason);
  99. void isis_adj_print (struct isis_adjacency *adj);
  100. int isis_adj_expire (struct thread *thread);
  101. void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty);
  102. void isis_adj_print_vty_detail (struct isis_adjacency *adj, struct vty *vty);
  103. void isis_adj_print_vty_extensive (struct isis_adjacency *adj,
  104. struct vty *vty);
  105. void isis_adj_p2p_print_vty (struct isis_adjacency *adj, struct vty *vty);
  106. void isis_adj_p2p_print_vty_detail (struct isis_adjacency *adj,
  107. struct vty *vty);
  108. void isis_adj_p2p_print_vty_extensive (struct isis_adjacency *adj,
  109. struct vty *vty);
  110. void isis_adj_build_neigh_list (struct list *adjdb, struct list *list);
  111. void isis_adj_build_up_list (struct list *adjdb, struct list *list);
  112. void isis_adjdb_iterate (struct list *adjdb,
  113. void (*func) (struct isis_adjacency *,
  114. void *), void *arg);
  115. #endif /* ISIS_ADJACENCY_H */