bgp_debug.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /* BGP message debug header.
  2. Copyright (C) 1996, 97, 98 Kunihiro Ishiguro
  3. This file is part of GNU Zebra.
  4. GNU Zebra is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. GNU Zebra is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Zebra; see the file COPYING. If not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. 02111-1307, USA. */
  16. #ifndef _QUAGGA_BGP_DEBUG_H
  17. #define _QUAGGA_BGP_DEBUG_H
  18. #include "bgp_attr.h"
  19. /* sort of packet direction */
  20. #define DUMP_ON 1
  21. #define DUMP_SEND 2
  22. #define DUMP_RECV 4
  23. /* for dump_update */
  24. #define DUMP_WITHDRAW 8
  25. #define DUMP_NLRI 16
  26. /* dump detail */
  27. #define DUMP_DETAIL 32
  28. extern int dump_open;
  29. extern int dump_update;
  30. extern int dump_keepalive;
  31. extern int dump_notify;
  32. extern int Debug_Event;
  33. extern int Debug_Keepalive;
  34. extern int Debug_Update;
  35. extern int Debug_Radix;
  36. #define NLRI 1
  37. #define WITHDRAW 2
  38. #define NO_OPT 3
  39. #define SEND 4
  40. #define RECV 5
  41. #define DETAIL 6
  42. /* Prototypes. */
  43. extern void bgp_debug_init (void);
  44. extern void bgp_packet_dump (struct stream *);
  45. extern int debug (unsigned int option);
  46. extern unsigned long conf_bgp_debug_as4;
  47. extern unsigned long conf_bgp_debug_fsm;
  48. extern unsigned long conf_bgp_debug_events;
  49. extern unsigned long conf_bgp_debug_packet;
  50. extern unsigned long conf_bgp_debug_filter;
  51. extern unsigned long conf_bgp_debug_keepalive;
  52. extern unsigned long conf_bgp_debug_update;
  53. extern unsigned long conf_bgp_debug_normal;
  54. extern unsigned long conf_bgp_debug_zebra;
  55. extern unsigned long conf_bgp_debug_allow_martians;
  56. extern unsigned long conf_bgp_debug_nht;
  57. extern unsigned long term_bgp_debug_as4;
  58. extern unsigned long term_bgp_debug_fsm;
  59. extern unsigned long term_bgp_debug_events;
  60. extern unsigned long term_bgp_debug_packet;
  61. extern unsigned long term_bgp_debug_filter;
  62. extern unsigned long term_bgp_debug_keepalive;
  63. extern unsigned long term_bgp_debug_update;
  64. extern unsigned long term_bgp_debug_normal;
  65. extern unsigned long term_bgp_debug_zebra;
  66. extern unsigned long term_bgp_debug_allow_martians;
  67. extern unsigned long term_bgp_debug_nht;
  68. #define BGP_DEBUG_AS4 0x01
  69. #define BGP_DEBUG_AS4_SEGMENT 0x02
  70. #define BGP_DEBUG_FSM 0x01
  71. #define BGP_DEBUG_EVENTS 0x01
  72. #define BGP_DEBUG_PACKET 0x01
  73. #define BGP_DEBUG_FILTER 0x01
  74. #define BGP_DEBUG_KEEPALIVE 0x01
  75. #define BGP_DEBUG_UPDATE_IN 0x01
  76. #define BGP_DEBUG_UPDATE_OUT 0x02
  77. #define BGP_DEBUG_NORMAL 0x01
  78. #define BGP_DEBUG_ZEBRA 0x01
  79. #define BGP_DEBUG_ALLOW_MARTIANS 0x01
  80. #define BGP_DEBUG_NHT 0x01
  81. #define BGP_DEBUG_PACKET_SEND 0x01
  82. #define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
  83. #define BGP_DEBUG_PACKET_RECV 0x01
  84. #define BGP_DEBUG_PACKET_RECV_DETAIL 0x02
  85. #define CONF_DEBUG_ON(a, b) (conf_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
  86. #define CONF_DEBUG_OFF(a, b) (conf_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
  87. #define TERM_DEBUG_ON(a, b) (term_bgp_debug_ ## a |= (BGP_DEBUG_ ## b))
  88. #define TERM_DEBUG_OFF(a, b) (term_bgp_debug_ ## a &= ~(BGP_DEBUG_ ## b))
  89. #define DEBUG_ON(a, b) \
  90. do { \
  91. CONF_DEBUG_ON(a, b); \
  92. TERM_DEBUG_ON(a, b); \
  93. } while (0)
  94. #define DEBUG_OFF(a, b) \
  95. do { \
  96. CONF_DEBUG_OFF(a, b); \
  97. TERM_DEBUG_OFF(a, b); \
  98. } while (0)
  99. #define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
  100. #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
  101. extern const char *bgp_type_str[];
  102. extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
  103. extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
  104. extern const struct message bgp_status_msg[];
  105. extern const int bgp_status_msg_max;
  106. #endif /* _QUAGGA_BGP_DEBUG_H */