]>
git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_message.h
2 * Copyright (C) 1999-2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef OSPF6_MESSAGE_H
22 #define OSPF6_MESSAGE_H
24 #define OSPF6_MESSAGE_BUFSIZ 4096
27 extern unsigned char conf_debug_ospf6_message
[];
29 #define OSPF6_ACTION_SEND 0x01
30 #define OSPF6_ACTION_RECV 0x02
31 #define OSPF6_DEBUG_MESSAGE_SEND 0x01
32 #define OSPF6_DEBUG_MESSAGE_RECV 0x02
33 #define OSPF6_DEBUG_MESSAGE_SEND_HDR 0x04
34 #define OSPF6_DEBUG_MESSAGE_RECV_HDR 0x08
35 #define OSPF6_DEBUG_MESSAGE_SEND_BOTH \
36 OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_SEND_HDR
37 #define OSPF6_DEBUG_MESSAGE_RECV_BOTH \
38 OSPF6_DEBUG_MESSAGE_RECV | OSPF6_DEBUG_MESSAGE_RECV_HDR
40 #define OSPF6_DEBUG_MESSAGE_ON(type, level) \
41 (conf_debug_ospf6_message[type] |= (level))
42 #define OSPF6_DEBUG_MESSAGE_OFF(type, level) \
43 (conf_debug_ospf6_message[type] &= ~(level))
45 #define IS_OSPF6_DEBUG_MESSAGE(t, e) \
46 (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_RECV_HDR) \
47 ? (conf_debug_ospf6_message[t] \
48 & (OSPF6_DEBUG_MESSAGE_RECV_BOTH)) \
49 : (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_SEND_HDR) \
50 ? (conf_debug_ospf6_message[t] \
51 & (OSPF6_DEBUG_MESSAGE_SEND_BOTH)) \
52 : (conf_debug_ospf6_message[t] \
53 & (OSPF6_DEBUG_MESSAGE_##e))))
55 #define IS_OSPF6_DEBUG_MESSAGE_ENABLED(type, e) \
56 (conf_debug_ospf6_message[type] & (OSPF6_DEBUG_MESSAGE_##e))
59 #define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0
60 #define OSPF6_MESSAGE_TYPE_HELLO 0x1 /* Discover/maintain neighbors */
61 #define OSPF6_MESSAGE_TYPE_DBDESC 0x2 /* Summarize database contents */
62 #define OSPF6_MESSAGE_TYPE_LSREQ 0x3 /* Database download request */
63 #define OSPF6_MESSAGE_TYPE_LSUPDATE 0x4 /* Database update */
64 #define OSPF6_MESSAGE_TYPE_LSACK 0x5 /* Flooding acknowledgment */
65 #define OSPF6_MESSAGE_TYPE_ALL 0x6 /* For debug option */
66 #define OSPF6_MESSAGE_TYPE_MAX 0x6 /* same as OSPF6_MESSAGE_TYPE_ALL */
69 struct ospf6_packet
*next
;
71 /* Pointer to data stream. */
74 /* IP destination address. */
77 /* OSPF6 packet length. */
81 /* OSPF packet queue structure. */
85 struct ospf6_packet
*head
;
86 struct ospf6_packet
*tail
;
89 /* OSPFv3 packet header */
90 #define OSPF6_HEADER_SIZE 16U
102 #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length))
105 #define OSPF6_HELLO_MIN_SIZE 20U
107 ifindex_t interface_id
;
110 uint16_t hello_interval
;
111 uint16_t dead_interval
;
114 /* Followed by Router-IDs */
117 /* Database Description */
118 #define OSPF6_DB_DESC_MIN_SIZE 12U
119 struct ospf6_dbdesc
{
126 /* Followed by LSA Headers */
129 #define OSPF6_DBDESC_MSBIT (0x01) /* master/slave bit */
130 #define OSPF6_DBDESC_MBIT (0x02) /* more bit */
131 #define OSPF6_DBDESC_IBIT (0x04) /* initial bit */
133 /* Link State Request */
134 #define OSPF6_LS_REQ_MIN_SIZE 0U
135 /* It is just a sequence of entries below */
136 #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U
137 struct ospf6_lsreq_entry
{
138 uint16_t reserved
; /* Must Be Zero */
139 uint16_t type
; /* LS type */
140 in_addr_t id
; /* Link State ID */
141 in_addr_t adv_router
; /* Advertising Router */
144 /* Link State Update */
145 #define OSPF6_LS_UPD_MIN_SIZE 4U
146 struct ospf6_lsupdate
{
148 /* Followed by LSAs */
151 /* LLS is not supported, but used to derive
152 * offset of Auth_trailer
154 struct ospf6_lls_hdr
{
159 /* Link State Acknowledgement */
160 #define OSPF6_LS_ACK_MIN_SIZE 0U
161 /* It is just a sequence of LSA Headers */
163 /* Function definition */
164 extern void ospf6_hello_print(struct ospf6_header
*, int action
);
165 extern void ospf6_dbdesc_print(struct ospf6_header
*, int action
);
166 extern void ospf6_lsreq_print(struct ospf6_header
*, int action
);
167 extern void ospf6_lsupdate_print(struct ospf6_header
*, int action
);
168 extern void ospf6_lsack_print(struct ospf6_header
*, int action
);
170 extern struct ospf6_fifo
*ospf6_fifo_new(void);
171 extern void ospf6_fifo_flush(struct ospf6_fifo
*fifo
);
172 extern void ospf6_fifo_free(struct ospf6_fifo
*fifo
);
174 extern int ospf6_iobuf_size(unsigned int size
);
175 extern void ospf6_message_terminate(void);
176 extern void ospf6_receive(struct thread
*thread
);
178 extern void ospf6_hello_send(struct thread
*thread
);
179 extern void ospf6_dbdesc_send(struct thread
*thread
);
180 extern void ospf6_dbdesc_send_newone(struct thread
*thread
);
181 extern void ospf6_lsreq_send(struct thread
*thread
);
182 extern void ospf6_lsupdate_send_interface(struct thread
*thread
);
183 extern void ospf6_lsupdate_send_neighbor(struct thread
*thread
);
184 extern void ospf6_lsack_send_interface(struct thread
*thread
);
185 extern void ospf6_lsack_send_neighbor(struct thread
*thread
);
187 extern int config_write_ospf6_debug_message(struct vty
*);
188 extern void install_element_ospf6_debug_message(void);
189 extern const char *ospf6_message_type(int type
);
190 #endif /* OSPF6_MESSAGE_H */