bgp_fsm.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* BGP-4 Finite State Machine
  2. From RFC1771 [A Border Gateway Protocol 4 (BGP-4)]
  3. Copyright (C) 1998 Kunihiro Ishiguro
  4. This file is part of GNU Zebra.
  5. GNU Zebra is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option) any
  8. later version.
  9. GNU Zebra is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Zebra; see the file COPYING. If not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. 02111-1307, USA. */
  17. #ifndef _QUAGGA_BGP_FSM_H
  18. #define _QUAGGA_BGP_FSM_H
  19. /* Macro for BGP read, write and timer thread. */
  20. #define BGP_READ_ON(T,F,V) \
  21. do { \
  22. if (!(T) && (peer->status != Deleted)) \
  23. THREAD_READ_ON(bm->master,T,F,peer,V); \
  24. } while (0)
  25. #define BGP_READ_OFF(T) \
  26. do { \
  27. if (T) \
  28. THREAD_READ_OFF(T); \
  29. } while (0)
  30. #define BGP_WRITE_ON(T,F,V) \
  31. do { \
  32. if (!(T) && (peer->status != Deleted)) \
  33. THREAD_WRITE_ON(bm->master,(T),(F),peer,(V)); \
  34. } while (0)
  35. #define BGP_WRITE_OFF(T) \
  36. do { \
  37. if (T) \
  38. THREAD_WRITE_OFF(T); \
  39. } while (0)
  40. #define BGP_TIMER_ON(T,F,V) \
  41. do { \
  42. if (!(T) && (peer->status != Deleted)) \
  43. THREAD_TIMER_ON(bm->master,(T),(F),peer,(V)); \
  44. } while (0)
  45. #define BGP_TIMER_OFF(T) \
  46. do { \
  47. if (T) \
  48. THREAD_TIMER_OFF(T); \
  49. } while (0)
  50. #define BGP_EVENT_ADD(P,E) \
  51. do { \
  52. if ((P)->status != Deleted) \
  53. thread_add_event (bm->master, bgp_event, (P), (E)); \
  54. } while (0)
  55. #define BGP_EVENT_FLUSH(P) \
  56. do { \
  57. assert (peer); \
  58. thread_cancel_event (bm->master, (P)); \
  59. } while (0)
  60. /* Prototypes. */
  61. extern int bgp_event (struct thread *);
  62. extern int bgp_stop (struct peer *peer);
  63. extern void bgp_timer_set (struct peer *);
  64. extern void bgp_fsm_change_status (struct peer *peer, int status);
  65. extern const char *peer_down_str[];
  66. #endif /* _QUAGGA_BGP_FSM_H */