]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_dump.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / ospfd / ospf_dump.h
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 along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifndef _ZEBRA_OSPF_DUMP_H
23 #define _ZEBRA_OSPF_DUMP_H
24
25 /* Debug Flags. */
26 #define OSPF_DEBUG_HELLO 0x01
27 #define OSPF_DEBUG_DB_DESC 0x02
28 #define OSPF_DEBUG_LS_REQ 0x04
29 #define OSPF_DEBUG_LS_UPD 0x08
30 #define OSPF_DEBUG_LS_ACK 0x10
31 #define OSPF_DEBUG_ALL 0x1f
32
33 #define OSPF_DEBUG_SEND 0x01
34 #define OSPF_DEBUG_RECV 0x02
35 #define OSPF_DEBUG_SEND_RECV 0x03
36 #define OSPF_DEBUG_DETAIL 0x04
37
38 #define OSPF_DEBUG_ISM_STATUS 0x01
39 #define OSPF_DEBUG_ISM_EVENTS 0x02
40 #define OSPF_DEBUG_ISM_TIMERS 0x04
41 #define OSPF_DEBUG_ISM 0x07
42 #define OSPF_DEBUG_NSM_STATUS 0x01
43 #define OSPF_DEBUG_NSM_EVENTS 0x02
44 #define OSPF_DEBUG_NSM_TIMERS 0x04
45 #define OSPF_DEBUG_NSM 0x07
46
47 #define OSPF_DEBUG_LSA_GENERATE 0x01
48 #define OSPF_DEBUG_LSA_FLOODING 0x02
49 #define OSPF_DEBUG_LSA_INSTALL 0x04
50 #define OSPF_DEBUG_LSA_REFRESH 0x08
51 #define OSPF_DEBUG_LSA 0x0F
52
53 #define OSPF_DEBUG_ZEBRA_INTERFACE 0x01
54 #define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02
55 #define OSPF_DEBUG_ZEBRA 0x03
56
57 #define OSPF_DEBUG_EVENT 0x01
58 #define OSPF_DEBUG_NSSA 0x02
59 #define OSPF_DEBUG_TE 0x04
60 #define OSPF_DEBUG_EXT 0x08
61 #define OSPF_DEBUG_SR 0x10
62
63 /* Macro for setting debug option. */
64 #define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
65 #define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
66 #define TERM_DEBUG_PACKET_ON(a, b) term_debug_ospf_packet[a] |= (b)
67 #define TERM_DEBUG_PACKET_OFF(a, b) term_debug_ospf_packet[a] &= ~(b)
68 #define DEBUG_PACKET_ON(a, b) \
69 do { \
70 CONF_DEBUG_PACKET_ON(a, b); \
71 TERM_DEBUG_PACKET_ON(a, b); \
72 } while (0)
73 #define DEBUG_PACKET_OFF(a, b) \
74 do { \
75 CONF_DEBUG_PACKET_OFF(a, b); \
76 TERM_DEBUG_PACKET_OFF(a, b); \
77 } while (0)
78
79 #define CONF_DEBUG_ON(a, b) conf_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
80 #define CONF_DEBUG_OFF(a, b) conf_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
81 #define TERM_DEBUG_ON(a, b) term_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
82 #define TERM_DEBUG_OFF(a, b) term_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
83 #define DEBUG_ON(a, b) \
84 do { \
85 CONF_DEBUG_ON(a, b); \
86 TERM_DEBUG_ON(a, b); \
87 } while (0)
88 #define DEBUG_OFF(a, b) \
89 do { \
90 CONF_DEBUG_OFF(a, b); \
91 TERM_DEBUG_OFF(a, b); \
92 } while (0)
93
94 /* Macro for checking debug option. */
95 #define IS_DEBUG_OSPF_PACKET(a, b) (term_debug_ospf_packet[a] & OSPF_DEBUG_##b)
96 #define IS_DEBUG_OSPF(a, b) (term_debug_ospf_##a & OSPF_DEBUG_##b)
97 #define IS_DEBUG_OSPF_EVENT IS_DEBUG_OSPF(event, EVENT)
98
99 #define IS_DEBUG_OSPF_NSSA IS_DEBUG_OSPF(nssa, NSSA)
100
101 #define IS_DEBUG_OSPF_TE IS_DEBUG_OSPF(te, TE)
102
103 #define IS_DEBUG_OSPF_EXT IS_DEBUG_OSPF(ext, EXT)
104
105 #define IS_DEBUG_OSPF_SR IS_DEBUG_OSPF(sr, SR)
106
107 #define IS_CONF_DEBUG_OSPF_PACKET(a, b) \
108 (conf_debug_ospf_packet[a] & OSPF_DEBUG_##b)
109 #define IS_CONF_DEBUG_OSPF(a, b) (conf_debug_ospf_##a & OSPF_DEBUG_##b)
110
111 #ifdef ORIGINAL_CODING
112 #else /* ORIGINAL_CODING */
113 struct stream;
114 #endif /* ORIGINAL_CODING */
115
116 #define AREA_NAME(A) ospf_area_name_string ((A))
117 #define IF_NAME(I) ospf_if_name_string ((I))
118
119 /* Extern debug flag. */
120 extern unsigned long term_debug_ospf_packet[];
121 extern unsigned long term_debug_ospf_event;
122 extern unsigned long term_debug_ospf_ism;
123 extern unsigned long term_debug_ospf_nsm;
124 extern unsigned long term_debug_ospf_lsa;
125 extern unsigned long term_debug_ospf_zebra;
126 extern unsigned long term_debug_ospf_nssa;
127 extern unsigned long term_debug_ospf_te;
128 extern unsigned long term_debug_ospf_ext;
129 extern unsigned long term_debug_ospf_sr;
130
131 /* Message Strings. */
132 extern char *ospf_lsa_type_str[];
133
134 /* Prototypes. */
135 extern const char *ospf_area_name_string(struct ospf_area *);
136 extern const char *ospf_area_desc_string(struct ospf_area *);
137 extern const char *ospf_if_name_string(struct ospf_interface *);
138 extern void ospf_nbr_state_message(struct ospf_neighbor *, char *, size_t);
139 extern const char *ospf_timer_dump(struct thread *, char *, size_t);
140 extern const char *ospf_timeval_dump(struct timeval *, char *, size_t);
141 extern void ospf_ip_header_dump(struct ip *);
142 extern void ospf_packet_dump(struct stream *);
143 extern void ospf_debug_init(void);
144
145 /* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */
146 #define OSPF_TIME_DUMP_SIZE 16
147
148 #endif /* _ZEBRA_OSPF_DUMP_H */