isis_adjacency.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_UNKNOWN,
  43. ISIS_ADJ_INITIALIZING,
  44. ISIS_ADJ_UP,
  45. ISIS_ADJ_DOWN
  46. };
  47. /*
  48. * we use the following codes to give an indication _why_
  49. * a specific adjacency is up or down
  50. */
  51. enum isis_adj_updown_reason
  52. {
  53. ISIS_ADJ_REASON_SEENSELF,
  54. ISIS_ADJ_REASON_AREA_MISMATCH,
  55. ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
  56. ISIS_ADJ_REASON_AUTH_FAILED,
  57. ISIS_ADJ_REASON_CHECKSUM_FAILED
  58. };
  59. #define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
  60. struct isis_dis_record
  61. {
  62. int dis; /* is our neighbor the DIS ? */
  63. time_t last_dis_change; /* timestamp for last dis change */
  64. };
  65. struct isis_adjacency
  66. {
  67. u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
  68. u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
  69. u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */
  70. int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */
  71. /* an array of N levels for M records */
  72. struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS];
  73. enum isis_adj_state adj_state; /* adjacencyState */
  74. enum isis_adj_usage adj_usage; /* adjacencyUsage */
  75. struct list *area_addrs; /* areaAdressesOfNeighbour */
  76. struct nlpids nlpids; /* protocols spoken ... */
  77. struct list *ipv4_addrs;
  78. struct in_addr router_address;
  79. #ifdef HAVE_IPV6
  80. struct list *ipv6_addrs;
  81. struct in6_addr router_address6;
  82. #endif /* HAVE_IPV6 */
  83. u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
  84. int circuit_t; /* from hello PDU hdr */
  85. int level; /* level (1 or 2) */
  86. enum isis_system_type sys_type; /* neighbourSystemType */
  87. u_int16_t hold_time; /* entryRemainingTime */
  88. u_int32_t last_upd;
  89. u_int32_t last_flap; /* last time the adj flapped */
  90. int flaps; /* number of adjacency flaps */
  91. struct thread *t_expire; /* expire after hold_time */
  92. struct isis_circuit *circuit; /* back pointer */
  93. };
  94. struct isis_adjacency *isis_adj_lookup (const u_char * sysid, struct list *adjdb);
  95. struct isis_adjacency *isis_adj_lookup_snpa (const u_char * ssnpa,
  96. struct list *adjdb);
  97. struct isis_adjacency *isis_new_adj (const u_char * id, const u_char * snpa, int level,
  98. struct isis_circuit *circuit);
  99. void isis_delete_adj (void *adj);
  100. void isis_adj_state_change (struct isis_adjacency *adj,
  101. enum isis_adj_state state, const char *reason);
  102. void isis_adj_print (struct isis_adjacency *adj);
  103. int isis_adj_expire (struct thread *thread);
  104. void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail);
  105. void isis_adj_build_neigh_list (struct list *adjdb, struct list *list);
  106. void isis_adj_build_up_list (struct list *adjdb, struct list *list);
  107. #endif /* ISIS_ADJACENCY_H */