paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
| 23 | #ifndef _ZEBRA_OSPF_DUMP_H |
| 24 | #define _ZEBRA_OSPF_DUMP_H |
| 25 | |
| 26 | /* Debug Flags. */ |
| 27 | #define OSPF_DEBUG_HELLO 0x01 |
| 28 | #define OSPF_DEBUG_DB_DESC 0x02 |
| 29 | #define OSPF_DEBUG_LS_REQ 0x04 |
| 30 | #define OSPF_DEBUG_LS_UPD 0x08 |
| 31 | #define OSPF_DEBUG_LS_ACK 0x10 |
| 32 | #define OSPF_DEBUG_ALL 0x1f |
| 33 | |
| 34 | #define OSPF_DEBUG_SEND 0x01 |
| 35 | #define OSPF_DEBUG_RECV 0x02 |
| 36 | #define OSPF_DEBUG_SEND_RECV 0x03 |
| 37 | #define OSPF_DEBUG_DETAIL 0x04 |
| 38 | |
| 39 | #define OSPF_DEBUG_ISM_STATUS 0x01 |
| 40 | #define OSPF_DEBUG_ISM_EVENTS 0x02 |
| 41 | #define OSPF_DEBUG_ISM_TIMERS 0x04 |
| 42 | #define OSPF_DEBUG_ISM 0x07 |
| 43 | #define OSPF_DEBUG_NSM_STATUS 0x01 |
| 44 | #define OSPF_DEBUG_NSM_EVENTS 0x02 |
| 45 | #define OSPF_DEBUG_NSM_TIMERS 0x04 |
| 46 | #define OSPF_DEBUG_NSM 0x07 |
| 47 | |
| 48 | #define OSPF_DEBUG_LSA_GENERATE 0x01 |
| 49 | #define OSPF_DEBUG_LSA_FLOODING 0x02 |
| 50 | #define OSPF_DEBUG_LSA_INSTALL 0x04 |
| 51 | #define OSPF_DEBUG_LSA_REFRESH 0x08 |
| 52 | #define OSPF_DEBUG_LSA 0x0F |
| 53 | |
| 54 | #define OSPF_DEBUG_ZEBRA_INTERFACE 0x01 |
| 55 | #define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02 |
| 56 | #define OSPF_DEBUG_ZEBRA 0x03 |
| 57 | |
| 58 | #define OSPF_DEBUG_EVENT 0x01 |
| 59 | #define OSPF_DEBUG_NSSA 0x02 |
Olivier Dugeon | 29a1401 | 2016-04-19 18:42:40 +0200 | [diff] [blame] | 60 | #define OSPF_DEBUG_TE 0x04 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | |
| 62 | /* Macro for setting debug option. */ |
| 63 | #define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b) |
| 64 | #define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b) |
| 65 | #define TERM_DEBUG_PACKET_ON(a, b) term_debug_ospf_packet[a] |= (b) |
| 66 | #define TERM_DEBUG_PACKET_OFF(a, b) term_debug_ospf_packet[a] &= ~(b) |
| 67 | #define DEBUG_PACKET_ON(a, b) \ |
| 68 | do { \ |
| 69 | CONF_DEBUG_PACKET_ON(a, b); \ |
| 70 | TERM_DEBUG_PACKET_ON(a, b); \ |
| 71 | } while (0) |
| 72 | #define DEBUG_PACKET_OFF(a, b) \ |
| 73 | do { \ |
| 74 | CONF_DEBUG_PACKET_OFF(a, b); \ |
| 75 | TERM_DEBUG_PACKET_OFF(a, b); \ |
| 76 | } while (0) |
| 77 | |
| 78 | #define CONF_DEBUG_ON(a, b) conf_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b) |
| 79 | #define CONF_DEBUG_OFF(a, b) conf_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b) |
| 80 | #define TERM_DEBUG_ON(a, b) term_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b) |
| 81 | #define TERM_DEBUG_OFF(a, b) term_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b) |
| 82 | #define DEBUG_ON(a, b) \ |
| 83 | do { \ |
| 84 | CONF_DEBUG_ON(a, b); \ |
| 85 | TERM_DEBUG_ON(a, b); \ |
| 86 | } while (0) |
| 87 | #define DEBUG_OFF(a, b) \ |
| 88 | do { \ |
| 89 | CONF_DEBUG_OFF(a, b); \ |
| 90 | TERM_DEBUG_OFF(a, b); \ |
| 91 | } while (0) |
| 92 | |
| 93 | /* Macro for checking debug option. */ |
| 94 | #define IS_DEBUG_OSPF_PACKET(a, b) \ |
| 95 | (term_debug_ospf_packet[a] & OSPF_DEBUG_ ## b) |
| 96 | #define IS_DEBUG_OSPF(a, b) \ |
| 97 | (term_debug_ospf_ ## a & OSPF_DEBUG_ ## b) |
| 98 | #define IS_DEBUG_OSPF_EVENT IS_DEBUG_OSPF(event,EVENT) |
| 99 | |
paul | 305100f | 2003-06-22 08:14:51 +0000 | [diff] [blame] | 100 | #define IS_DEBUG_OSPF_NSSA IS_DEBUG_OSPF(nssa,NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 101 | |
Olivier Dugeon | 29a1401 | 2016-04-19 18:42:40 +0200 | [diff] [blame] | 102 | #define IS_DEBUG_OSPF_TE IS_DEBUG_OSPF(te,TE) |
| 103 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 104 | #define IS_CONF_DEBUG_OSPF_PACKET(a, b) \ |
| 105 | (conf_debug_ospf_packet[a] & OSPF_DEBUG_ ## b) |
| 106 | #define IS_CONF_DEBUG_OSPF(a, b) \ |
| 107 | (conf_debug_ospf_ ## a & OSPF_DEBUG_ ## b) |
| 108 | |
| 109 | #ifdef ORIGINAL_CODING |
| 110 | #else /* ORIGINAL_CODING */ |
| 111 | struct stream; |
| 112 | #endif /* ORIGINAL_CODING */ |
| 113 | |
| 114 | #define AREA_NAME(A) ospf_area_name_string ((A)) |
| 115 | #define IF_NAME(I) ospf_if_name_string ((I)) |
| 116 | |
| 117 | /* Extern debug flag. */ |
| 118 | extern unsigned long term_debug_ospf_packet[]; |
| 119 | extern unsigned long term_debug_ospf_event; |
| 120 | extern unsigned long term_debug_ospf_ism; |
| 121 | extern unsigned long term_debug_ospf_nsm; |
| 122 | extern unsigned long term_debug_ospf_lsa; |
| 123 | extern unsigned long term_debug_ospf_zebra; |
| 124 | extern unsigned long term_debug_ospf_nssa; |
Olivier Dugeon | 29a1401 | 2016-04-19 18:42:40 +0200 | [diff] [blame] | 125 | extern unsigned long term_debug_ospf_te; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 126 | |
| 127 | /* Message Strings. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 128 | extern char *ospf_lsa_type_str[]; |
Denis Ovsienko | ef1b78c | 2012-02-26 17:00:57 +0400 | [diff] [blame] | 129 | extern const struct message ospf_auth_type_str[]; |
| 130 | extern const size_t ospf_auth_type_str_max; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 131 | |
| 132 | /* Prototypes. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 133 | extern const char *ospf_area_name_string (struct ospf_area *); |
| 134 | extern const char *ospf_area_desc_string (struct ospf_area *); |
| 135 | extern const char *ospf_if_name_string (struct ospf_interface *); |
| 136 | extern void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t); |
| 137 | extern char *ospf_options_dump (u_char); |
| 138 | extern const char *ospf_timer_dump (struct thread *, char *, size_t); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 139 | extern const char *ospf_timeval_dump (struct timeval *, char *, size_t); |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 140 | extern void ospf_ip_header_dump (struct ip *); |
| 141 | extern void ospf_packet_dump (struct stream *); |
| 142 | extern void ospf_lsa_header_dump (struct lsa_header *); |
| 143 | extern void debug_init (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 144 | |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 145 | /* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */ |
| 146 | #define OSPF_TIME_DUMP_SIZE 16 |
| 147 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 148 | #endif /* _ZEBRA_OSPF_DUMP_H */ |