]>
git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_message.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 1999-2003 Yasuhiro Ohara
6 #ifndef OSPF6_MESSAGE_H
7 #define OSPF6_MESSAGE_H
9 #define OSPF6_MESSAGE_BUFSIZ 4096
12 extern unsigned char conf_debug_ospf6_message
[];
14 #define OSPF6_ACTION_SEND 0x01
15 #define OSPF6_ACTION_RECV 0x02
16 #define OSPF6_DEBUG_MESSAGE_SEND 0x01
17 #define OSPF6_DEBUG_MESSAGE_RECV 0x02
18 #define OSPF6_DEBUG_MESSAGE_SEND_HDR 0x04
19 #define OSPF6_DEBUG_MESSAGE_RECV_HDR 0x08
20 #define OSPF6_DEBUG_MESSAGE_SEND_BOTH \
21 OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_SEND_HDR
22 #define OSPF6_DEBUG_MESSAGE_RECV_BOTH \
23 OSPF6_DEBUG_MESSAGE_RECV | OSPF6_DEBUG_MESSAGE_RECV_HDR
25 #define OSPF6_DEBUG_MESSAGE_ON(type, level) \
26 (conf_debug_ospf6_message[type] |= (level))
27 #define OSPF6_DEBUG_MESSAGE_OFF(type, level) \
28 (conf_debug_ospf6_message[type] &= ~(level))
30 #define IS_OSPF6_DEBUG_MESSAGE(t, e) \
31 (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_RECV_HDR) \
32 ? (conf_debug_ospf6_message[t] \
33 & (OSPF6_DEBUG_MESSAGE_RECV_BOTH)) \
34 : (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_SEND_HDR) \
35 ? (conf_debug_ospf6_message[t] \
36 & (OSPF6_DEBUG_MESSAGE_SEND_BOTH)) \
37 : (conf_debug_ospf6_message[t] \
38 & (OSPF6_DEBUG_MESSAGE_##e))))
40 #define IS_OSPF6_DEBUG_MESSAGE_ENABLED(type, e) \
41 (conf_debug_ospf6_message[type] & (OSPF6_DEBUG_MESSAGE_##e))
44 #define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0
45 #define OSPF6_MESSAGE_TYPE_HELLO 0x1 /* Discover/maintain neighbors */
46 #define OSPF6_MESSAGE_TYPE_DBDESC 0x2 /* Summarize database contents */
47 #define OSPF6_MESSAGE_TYPE_LSREQ 0x3 /* Database download request */
48 #define OSPF6_MESSAGE_TYPE_LSUPDATE 0x4 /* Database update */
49 #define OSPF6_MESSAGE_TYPE_LSACK 0x5 /* Flooding acknowledgment */
50 #define OSPF6_MESSAGE_TYPE_ALL 0x6 /* For debug option */
51 #define OSPF6_MESSAGE_TYPE_MAX 0x6 /* same as OSPF6_MESSAGE_TYPE_ALL */
54 struct ospf6_packet
*next
;
56 /* Pointer to data stream. */
59 /* IP destination address. */
62 /* OSPF6 packet length. */
66 /* OSPF packet queue structure. */
70 struct ospf6_packet
*head
;
71 struct ospf6_packet
*tail
;
74 /* OSPFv3 packet header */
75 #define OSPF6_HEADER_SIZE 16U
87 #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length))
90 #define OSPF6_HELLO_MIN_SIZE 20U
92 ifindex_t interface_id
;
95 uint16_t hello_interval
;
96 uint16_t dead_interval
;
99 /* Followed by Router-IDs */
102 /* Database Description */
103 #define OSPF6_DB_DESC_MIN_SIZE 12U
104 struct ospf6_dbdesc
{
111 /* Followed by LSA Headers */
114 #define OSPF6_DBDESC_MSBIT (0x01) /* master/slave bit */
115 #define OSPF6_DBDESC_MBIT (0x02) /* more bit */
116 #define OSPF6_DBDESC_IBIT (0x04) /* initial bit */
118 /* Link State Request */
119 #define OSPF6_LS_REQ_MIN_SIZE 0U
120 /* It is just a sequence of entries below */
121 #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U
122 struct ospf6_lsreq_entry
{
123 uint16_t reserved
; /* Must Be Zero */
124 uint16_t type
; /* LS type */
125 in_addr_t id
; /* Link State ID */
126 in_addr_t adv_router
; /* Advertising Router */
129 /* Link State Update */
130 #define OSPF6_LS_UPD_MIN_SIZE 4U
131 struct ospf6_lsupdate
{
133 /* Followed by LSAs */
136 /* LLS is not supported, but used to derive
137 * offset of Auth_trailer
139 struct ospf6_lls_hdr
{
144 /* Link State Acknowledgement */
145 #define OSPF6_LS_ACK_MIN_SIZE 0U
146 /* It is just a sequence of LSA Headers */
148 /* Function definition */
149 extern void ospf6_hello_print(struct ospf6_header
*, int action
);
150 extern void ospf6_dbdesc_print(struct ospf6_header
*, int action
);
151 extern void ospf6_lsreq_print(struct ospf6_header
*, int action
);
152 extern void ospf6_lsupdate_print(struct ospf6_header
*, int action
);
153 extern void ospf6_lsack_print(struct ospf6_header
*, int action
);
155 extern struct ospf6_fifo
*ospf6_fifo_new(void);
156 extern void ospf6_fifo_flush(struct ospf6_fifo
*fifo
);
157 extern void ospf6_fifo_free(struct ospf6_fifo
*fifo
);
159 extern int ospf6_iobuf_size(unsigned int size
);
160 extern void ospf6_message_terminate(void);
161 extern void ospf6_receive(struct event
*thread
);
163 extern void ospf6_hello_send(struct event
*thread
);
164 extern void ospf6_dbdesc_send(struct event
*thread
);
165 extern void ospf6_dbdesc_send_newone(struct event
*thread
);
166 extern void ospf6_lsreq_send(struct event
*thread
);
167 extern void ospf6_lsupdate_send_interface(struct event
*thread
);
168 extern void ospf6_lsupdate_send_neighbor(struct event
*thread
);
169 extern void ospf6_lsack_send_interface(struct event
*thread
);
170 extern void ospf6_lsack_send_neighbor(struct event
*thread
);
172 extern int config_write_ospf6_debug_message(struct vty
*);
173 extern void install_element_ospf6_debug_message(void);
174 extern const char *ospf6_message_type(int type
);
175 #endif /* OSPF6_MESSAGE_H */