ospf6_neighbor.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (C) 2003 Yasuhiro Ohara
  3. *
  4. * This file is part of GNU Zebra.
  5. *
  6. * GNU Zebra is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2, or (at your option) any
  9. * later version.
  10. *
  11. * GNU Zebra is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GNU Zebra; see the file COPYING. If not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef OSPF6_NEIGHBOR_H
  22. #define OSPF6_NEIGHBOR_H
  23. /* Debug option */
  24. extern unsigned char conf_debug_ospf6_neighbor;
  25. #define OSPF6_DEBUG_NEIGHBOR_STATE 0x01
  26. #define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02
  27. #define OSPF6_DEBUG_NEIGHBOR_ON(level) \
  28. (conf_debug_ospf6_neighbor |= (level))
  29. #define OSPF6_DEBUG_NEIGHBOR_OFF(level) \
  30. (conf_debug_ospf6_neighbor &= ~(level))
  31. #define IS_OSPF6_DEBUG_NEIGHBOR(level) \
  32. (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_ ## level)
  33. /* Neighbor structure */
  34. struct ospf6_neighbor
  35. {
  36. /* Neighbor Router ID String */
  37. char name[32];
  38. /* OSPFv3 Interface this neighbor belongs to */
  39. struct ospf6_interface *ospf6_if;
  40. /* Neighbor state */
  41. u_char state;
  42. /* timestamp of last changing state */
  43. u_int32_t state_change;
  44. struct timeval last_changed;
  45. /* Neighbor Router ID */
  46. u_int32_t router_id;
  47. /* Neighbor Interface ID */
  48. ifindex_t ifindex;
  49. /* Router Priority of this neighbor */
  50. u_char priority;
  51. u_int32_t drouter;
  52. u_int32_t bdrouter;
  53. u_int32_t prev_drouter;
  54. u_int32_t prev_bdrouter;
  55. /* Options field (Capability) */
  56. char options[3];
  57. /* IPaddr of I/F on our side link */
  58. struct in6_addr linklocal_addr;
  59. /* For Database Exchange */
  60. u_char dbdesc_bits;
  61. u_int32_t dbdesc_seqnum;
  62. /* Last received Database Description packet */
  63. struct ospf6_dbdesc dbdesc_last;
  64. /* LS-list */
  65. struct ospf6_lsdb *summary_list;
  66. struct ospf6_lsdb *request_list;
  67. struct ospf6_lsdb *retrans_list;
  68. /* LSA list for message transmission */
  69. struct ospf6_lsdb *dbdesc_list;
  70. struct ospf6_lsdb *lsreq_list;
  71. struct ospf6_lsdb *lsupdate_list;
  72. struct ospf6_lsdb *lsack_list;
  73. struct ospf6_lsa *last_ls_req;
  74. /* Inactivity timer */
  75. struct thread *inactivity_timer;
  76. /* Thread for sending message */
  77. struct thread *thread_send_dbdesc;
  78. struct thread *thread_send_lsreq;
  79. struct thread *thread_send_lsupdate;
  80. struct thread *thread_send_lsack;
  81. };
  82. /* Neighbor state */
  83. #define OSPF6_NEIGHBOR_DOWN 1
  84. #define OSPF6_NEIGHBOR_ATTEMPT 2
  85. #define OSPF6_NEIGHBOR_INIT 3
  86. #define OSPF6_NEIGHBOR_TWOWAY 4
  87. #define OSPF6_NEIGHBOR_EXSTART 5
  88. #define OSPF6_NEIGHBOR_EXCHANGE 6
  89. #define OSPF6_NEIGHBOR_LOADING 7
  90. #define OSPF6_NEIGHBOR_FULL 8
  91. /* Neighbor Events */
  92. #define OSPF6_NEIGHBOR_EVENT_NO_EVENT 0
  93. #define OSPF6_NEIGHBOR_EVENT_HELLO_RCVD 1
  94. #define OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD 2
  95. #define OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE 3
  96. #define OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE 4
  97. #define OSPF6_NEIGHBOR_EVENT_LOADING_DONE 5
  98. #define OSPF6_NEIGHBOR_EVENT_ADJ_OK 6
  99. #define OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH 7
  100. #define OSPF6_NEIGHBOR_EVENT_BAD_LSREQ 8
  101. #define OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD 9
  102. #define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER 10
  103. #define OSPF6_NEIGHBOR_EVENT_MAX_EVENT 11
  104. extern const char *ospf6_neighbor_state_str[];
  105. /* Function Prototypes */
  106. int ospf6_neighbor_cmp (void *va, void *vb);
  107. void ospf6_neighbor_dbex_init (struct ospf6_neighbor *on);
  108. struct ospf6_neighbor *ospf6_neighbor_lookup (u_int32_t,
  109. struct ospf6_interface *);
  110. struct ospf6_neighbor *ospf6_neighbor_create (u_int32_t,
  111. struct ospf6_interface *);
  112. void ospf6_neighbor_delete (struct ospf6_neighbor *);
  113. /* Neighbor event */
  114. extern int hello_received (struct thread *);
  115. extern int twoway_received (struct thread *);
  116. extern int negotiation_done (struct thread *);
  117. extern int exchange_done (struct thread *);
  118. extern int loading_done (struct thread *);
  119. extern int adj_ok (struct thread *);
  120. extern int seqnumber_mismatch (struct thread *);
  121. extern int bad_lsreq (struct thread *);
  122. extern int oneway_received (struct thread *);
  123. extern int inactivity_timer (struct thread *);
  124. extern void ospf6_check_nbr_loading (struct ospf6_neighbor *);
  125. extern void ospf6_neighbor_init (void);
  126. extern int config_write_ospf6_debug_neighbor (struct vty *vty);
  127. extern void install_element_ospf6_debug_neighbor (void);
  128. #endif /* OSPF6_NEIGHBOR_H */