ospf_nsm.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * OSPF version 2 Neighbor State Machine
  3. * From RFC2328 [OSPF Version 2]
  4. * Copyright (C) 1999 Toshiaki Takada
  5. *
  6. * This file is part of GNU Zebra.
  7. *
  8. * GNU Zebra is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2, or (at your option) any
  11. * later version.
  12. *
  13. * GNU Zebra is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with GNU Zebra; see the file COPYING. If not, write to the Free
  20. * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  21. * 02111-1307, USA.
  22. */
  23. #ifndef _ZEBRA_OSPF_NSM_H
  24. #define _ZEBRA_OSPF_NSM_H
  25. /* OSPF Neighbor State Machine State. */
  26. #define NSM_DependUpon 0
  27. #define NSM_Deleted 1
  28. #define NSM_Down 2
  29. #define NSM_Attempt 3
  30. #define NSM_Init 4
  31. #define NSM_TwoWay 5
  32. #define NSM_ExStart 6
  33. #define NSM_Exchange 7
  34. #define NSM_Loading 8
  35. #define NSM_Full 9
  36. #define OSPF_NSM_STATE_MAX 10
  37. /* OSPF Neighbor State Machine Event. */
  38. #define NSM_NoEvent 0
  39. #define NSM_PacketReceived 1 /* HelloReceived in the protocol */
  40. #define NSM_Start 2
  41. #define NSM_TwoWayReceived 3
  42. #define NSM_NegotiationDone 4
  43. #define NSM_ExchangeDone 5
  44. #define NSM_BadLSReq 6
  45. #define NSM_LoadingDone 7
  46. #define NSM_AdjOK 8
  47. #define NSM_SeqNumberMismatch 9
  48. #define NSM_OneWayReceived 10
  49. #define NSM_KillNbr 11
  50. #define NSM_InactivityTimer 12
  51. #define NSM_LLDown 13
  52. #define OSPF_NSM_EVENT_MAX 14
  53. /* Macro for OSPF NSM timer turn on. */
  54. #define OSPF_NSM_TIMER_ON(T,F,V) \
  55. do { \
  56. if (!(T)) \
  57. (T) = thread_add_timer (master, (F), nbr, (V)); \
  58. } while (0)
  59. /* Macro for OSPF NSM timer turn off. */
  60. #define OSPF_NSM_TIMER_OFF(X) \
  61. do { \
  62. if (X) \
  63. { \
  64. thread_cancel (X); \
  65. (X) = NULL; \
  66. } \
  67. } while (0)
  68. /* Macro for OSPF NSM schedule event. */
  69. #define OSPF_NSM_EVENT_SCHEDULE(N,E) \
  70. thread_add_event (master, ospf_nsm_event, (N), (E))
  71. /* Macro for OSPF NSM execute event. */
  72. #define OSPF_NSM_EVENT_EXECUTE(N,E) \
  73. thread_execute (master, ospf_nsm_event, (N), (E))
  74. /* Prototypes. */
  75. extern int ospf_nsm_event (struct thread *);
  76. extern void ospf_check_nbr_loading (struct ospf_neighbor *);
  77. extern int ospf_db_summary_isempty (struct ospf_neighbor *);
  78. extern int ospf_db_summary_count (struct ospf_neighbor *);
  79. extern void ospf_db_summary_clear (struct ospf_neighbor *);
  80. #endif /* _ZEBRA_OSPF_NSM_H */