1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (C) 1999 Toshiaki Takada
7 #ifndef _ZEBRA_OSPF_DUMP_H
8 #define _ZEBRA_OSPF_DUMP_H
11 #define OSPF_DEBUG_HELLO 0x01
12 #define OSPF_DEBUG_DB_DESC 0x02
13 #define OSPF_DEBUG_LS_REQ 0x04
14 #define OSPF_DEBUG_LS_UPD 0x08
15 #define OSPF_DEBUG_LS_ACK 0x10
16 #define OSPF_DEBUG_ALL 0x1f
18 #define OSPF_DEBUG_SEND 0x01
19 #define OSPF_DEBUG_RECV 0x02
20 #define OSPF_DEBUG_SEND_RECV 0x03
21 #define OSPF_DEBUG_DETAIL 0x04
23 #define OSPF_DEBUG_ISM_STATUS 0x01
24 #define OSPF_DEBUG_ISM_EVENTS 0x02
25 #define OSPF_DEBUG_ISM_TIMERS 0x04
26 #define OSPF_DEBUG_ISM 0x07
27 #define OSPF_DEBUG_NSM_STATUS 0x01
28 #define OSPF_DEBUG_NSM_EVENTS 0x02
29 #define OSPF_DEBUG_NSM_TIMERS 0x04
30 #define OSPF_DEBUG_NSM 0x07
32 #define OSPF_DEBUG_LSA_GENERATE 0x01
33 #define OSPF_DEBUG_LSA_FLOODING 0x02
34 #define OSPF_DEBUG_LSA_INSTALL 0x04
35 #define OSPF_DEBUG_LSA_REFRESH 0x08
36 #define OSPF_DEBUG_LSA 0x0F
37 #define OSPF_DEBUG_EXTNL_LSA_AGGR 0x10
39 #define OSPF_DEBUG_ZEBRA_INTERFACE 0x01
40 #define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02
41 #define OSPF_DEBUG_ZEBRA 0x03
43 #define OSPF_DEBUG_EVENT 0x01
44 #define OSPF_DEBUG_NSSA 0x02
45 #define OSPF_DEBUG_TE 0x04
46 #define OSPF_DEBUG_EXT 0x08
47 #define OSPF_DEBUG_SR 0x10
48 #define OSPF_DEBUG_TI_LFA 0x11
49 #define OSPF_DEBUG_DEFAULTINFO 0x20
50 #define OSPF_DEBUG_LDP_SYNC 0x40
52 #define OSPF_DEBUG_GR 0x01
54 #define OSPF_DEBUG_BFD_LIB 0x01
56 #define OSPF_DEBUG_CLIENT_API 0x01
58 /* Macro for setting debug option. */
59 #define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
60 #define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
61 #define TERM_DEBUG_PACKET_ON(a, b) term_debug_ospf_packet[a] |= (b)
62 #define TERM_DEBUG_PACKET_OFF(a, b) term_debug_ospf_packet[a] &= ~(b)
63 #define DEBUG_PACKET_ON(a, b) \
65 CONF_DEBUG_PACKET_ON(a, b); \
66 TERM_DEBUG_PACKET_ON(a, b); \
68 #define DEBUG_PACKET_OFF(a, b) \
70 CONF_DEBUG_PACKET_OFF(a, b); \
71 TERM_DEBUG_PACKET_OFF(a, b); \
74 #define CONF_DEBUG_ON(a, b) conf_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
75 #define CONF_DEBUG_OFF(a, b) conf_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
76 #define TERM_DEBUG_ON(a, b) term_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
77 #define TERM_DEBUG_OFF(a, b) term_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
78 #define DEBUG_ON(a, b) \
80 CONF_DEBUG_ON(a, b); \
81 TERM_DEBUG_ON(a, b); \
83 #define DEBUG_OFF(a, b) \
85 CONF_DEBUG_OFF(a, b); \
86 TERM_DEBUG_OFF(a, b); \
89 /* Macro for checking debug option. */
90 #define IS_DEBUG_OSPF_PACKET(a, b) (term_debug_ospf_packet[a] & OSPF_DEBUG_##b)
91 #define IS_DEBUG_OSPF(a, b) (term_debug_ospf_##a & OSPF_DEBUG_##b)
92 #define IS_DEBUG_OSPF_EVENT IS_DEBUG_OSPF(event, EVENT)
94 #define IS_DEBUG_OSPF_NSSA IS_DEBUG_OSPF(nssa, NSSA)
96 #define IS_DEBUG_OSPF_TE IS_DEBUG_OSPF(te, TE)
98 #define IS_DEBUG_OSPF_EXT IS_DEBUG_OSPF(ext, EXT)
100 #define IS_DEBUG_OSPF_SR IS_DEBUG_OSPF(sr, SR)
102 #define IS_DEBUG_OSPF_TI_LFA IS_DEBUG_OSPF(ti_lfa, TI_LFA)
104 #define IS_DEBUG_OSPF_DEFAULT_INFO IS_DEBUG_OSPF(defaultinfo, DEFAULTINFO)
106 #define IS_DEBUG_OSPF_LDP_SYNC IS_DEBUG_OSPF(ldp_sync, LDP_SYNC)
107 #define IS_DEBUG_OSPF_GR IS_DEBUG_OSPF(gr, GR)
108 #define IS_DEBUG_OSPF_CLIENT_API IS_DEBUG_OSPF(client_api, CLIENT_API)
110 #define IS_CONF_DEBUG_OSPF_PACKET(a, b) \
111 (conf_debug_ospf_packet[a] & OSPF_DEBUG_##b)
112 #define IS_CONF_DEBUG_OSPF(a, b) (conf_debug_ospf_##a & OSPF_DEBUG_##b)
114 #define AREA_NAME(A) ospf_area_name_string ((A))
115 #define IF_NAME(I) ospf_if_name_string ((I))
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
;
125 extern unsigned long term_debug_ospf_te
;
126 extern unsigned long term_debug_ospf_ext
;
127 extern unsigned long term_debug_ospf_sr
;
128 extern unsigned long term_debug_ospf_ti_lfa
;
129 extern unsigned long term_debug_ospf_defaultinfo
;
130 extern unsigned long term_debug_ospf_ldp_sync
;
131 extern unsigned long term_debug_ospf_gr
;
132 extern unsigned long term_debug_ospf_bfd
;
133 extern unsigned long term_debug_ospf_client_api
;
135 /* Message Strings. */
136 extern char *ospf_lsa_type_str
[];
139 extern const char *ospf_area_name_string(struct ospf_area
*);
140 extern const char *ospf_area_desc_string(struct ospf_area
*);
141 extern const char *ospf_if_name_string(struct ospf_interface
*);
142 extern int ospf_nbr_ism_state(struct ospf_neighbor
*nbr
);
143 extern void ospf_nbr_state_message(struct ospf_neighbor
*nbr
, char *buf
,
145 extern void ospf_nbr_ism_state_message(struct ospf_neighbor
*nbr
, char *buf
,
147 extern const char *ospf_timer_dump(struct thread
*, char *, size_t);
148 extern const char *ospf_timeval_dump(struct timeval
*, char *, size_t);
149 extern void ospf_packet_dump(struct stream
*);
150 extern void ospf_debug_init(void);
152 /* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */
153 #define OSPF_TIME_DUMP_SIZE 16
155 #endif /* _ZEBRA_OSPF_DUMP_H */