ospf_dump.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * OSPFd dump routine.
  3. * Copyright (C) 1999 Toshiaki Takada
  4. *
  5. * This file is part of GNU Zebra.
  6. *
  7. * GNU Zebra is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2, or (at your option) any
  10. * later version.
  11. *
  12. * GNU Zebra is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Zebra; see the file COPYING. If not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef _ZEBRA_OSPF_DUMP_H
  23. #define _ZEBRA_OSPF_DUMP_H
  24. /* Debug Flags. */
  25. #define OSPF_DEBUG_HELLO 0x01
  26. #define OSPF_DEBUG_DB_DESC 0x02
  27. #define OSPF_DEBUG_LS_REQ 0x04
  28. #define OSPF_DEBUG_LS_UPD 0x08
  29. #define OSPF_DEBUG_LS_ACK 0x10
  30. #define OSPF_DEBUG_ALL 0x1f
  31. #define OSPF_DEBUG_SEND 0x01
  32. #define OSPF_DEBUG_RECV 0x02
  33. #define OSPF_DEBUG_SEND_RECV 0x03
  34. #define OSPF_DEBUG_DETAIL 0x04
  35. #define OSPF_DEBUG_ISM_STATUS 0x01
  36. #define OSPF_DEBUG_ISM_EVENTS 0x02
  37. #define OSPF_DEBUG_ISM_TIMERS 0x04
  38. #define OSPF_DEBUG_ISM 0x07
  39. #define OSPF_DEBUG_NSM_STATUS 0x01
  40. #define OSPF_DEBUG_NSM_EVENTS 0x02
  41. #define OSPF_DEBUG_NSM_TIMERS 0x04
  42. #define OSPF_DEBUG_NSM 0x07
  43. #define OSPF_DEBUG_LSA_GENERATE 0x01
  44. #define OSPF_DEBUG_LSA_FLOODING 0x02
  45. #define OSPF_DEBUG_LSA_INSTALL 0x04
  46. #define OSPF_DEBUG_LSA_REFRESH 0x08
  47. #define OSPF_DEBUG_LSA 0x0F
  48. #define OSPF_DEBUG_ZEBRA_INTERFACE 0x01
  49. #define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02
  50. #define OSPF_DEBUG_ZEBRA 0x03
  51. #define OSPF_DEBUG_EVENT 0x01
  52. #define OSPF_DEBUG_NSSA 0x02
  53. #define OSPF_DEBUG_TE 0x04
  54. /* Macro for setting debug option. */
  55. #define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
  56. #define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
  57. #define TERM_DEBUG_PACKET_ON(a, b) term_debug_ospf_packet[a] |= (b)
  58. #define TERM_DEBUG_PACKET_OFF(a, b) term_debug_ospf_packet[a] &= ~(b)
  59. #define DEBUG_PACKET_ON(a, b) \
  60. do { \
  61. CONF_DEBUG_PACKET_ON(a, b); \
  62. TERM_DEBUG_PACKET_ON(a, b); \
  63. } while (0)
  64. #define DEBUG_PACKET_OFF(a, b) \
  65. do { \
  66. CONF_DEBUG_PACKET_OFF(a, b); \
  67. TERM_DEBUG_PACKET_OFF(a, b); \
  68. } while (0)
  69. #define CONF_DEBUG_ON(a, b) conf_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
  70. #define CONF_DEBUG_OFF(a, b) conf_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
  71. #define TERM_DEBUG_ON(a, b) term_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
  72. #define TERM_DEBUG_OFF(a, b) term_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
  73. #define DEBUG_ON(a, b) \
  74. do { \
  75. CONF_DEBUG_ON(a, b); \
  76. TERM_DEBUG_ON(a, b); \
  77. } while (0)
  78. #define DEBUG_OFF(a, b) \
  79. do { \
  80. CONF_DEBUG_OFF(a, b); \
  81. TERM_DEBUG_OFF(a, b); \
  82. } while (0)
  83. /* Macro for checking debug option. */
  84. #define IS_DEBUG_OSPF_PACKET(a, b) \
  85. (term_debug_ospf_packet[a] & OSPF_DEBUG_ ## b)
  86. #define IS_DEBUG_OSPF(a, b) \
  87. (term_debug_ospf_ ## a & OSPF_DEBUG_ ## b)
  88. #define IS_DEBUG_OSPF_EVENT IS_DEBUG_OSPF(event,EVENT)
  89. #define IS_DEBUG_OSPF_NSSA IS_DEBUG_OSPF(nssa,NSSA)
  90. #define IS_DEBUG_OSPF_TE IS_DEBUG_OSPF(te,TE)
  91. #define IS_CONF_DEBUG_OSPF_PACKET(a, b) \
  92. (conf_debug_ospf_packet[a] & OSPF_DEBUG_ ## b)
  93. #define IS_CONF_DEBUG_OSPF(a, b) \
  94. (conf_debug_ospf_ ## a & OSPF_DEBUG_ ## b)
  95. #ifdef ORIGINAL_CODING
  96. #else /* ORIGINAL_CODING */
  97. struct stream;
  98. #endif /* ORIGINAL_CODING */
  99. #define AREA_NAME(A) ospf_area_name_string ((A))
  100. #define IF_NAME(I) ospf_if_name_string ((I))
  101. /* Extern debug flag. */
  102. extern unsigned long term_debug_ospf_packet[];
  103. extern unsigned long term_debug_ospf_event;
  104. extern unsigned long term_debug_ospf_ism;
  105. extern unsigned long term_debug_ospf_nsm;
  106. extern unsigned long term_debug_ospf_lsa;
  107. extern unsigned long term_debug_ospf_zebra;
  108. extern unsigned long term_debug_ospf_nssa;
  109. extern unsigned long term_debug_ospf_te;
  110. /* Message Strings. */
  111. extern char *ospf_lsa_type_str[];
  112. extern const struct message ospf_auth_type_str[];
  113. extern const size_t ospf_auth_type_str_max;
  114. /* Prototypes. */
  115. extern const char *ospf_area_name_string (struct ospf_area *);
  116. extern const char *ospf_area_desc_string (struct ospf_area *);
  117. extern const char *ospf_if_name_string (struct ospf_interface *);
  118. extern void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t);
  119. extern char *ospf_options_dump (u_char);
  120. extern const char *ospf_timer_dump (struct thread *, char *, size_t);
  121. extern const char *ospf_timeval_dump (struct timeval *, char *, size_t);
  122. extern void ospf_ip_header_dump (struct ip *);
  123. extern void ospf_packet_dump (struct stream *);
  124. extern void ospf_lsa_header_dump (struct lsa_header *);
  125. extern void debug_init (void);
  126. /* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */
  127. #define OSPF_TIME_DUMP_SIZE 16
  128. #endif /* _ZEBRA_OSPF_DUMP_H */