]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_message.h
Merge pull request #8593 from idryzhov/cmd-ambiguous
[mirror_frr.git] / ospf6d / ospf6_message.h
1 /*
2 * Copyright (C) 1999-2003 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
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
19 */
20
21 #ifndef OSPF6_MESSAGE_H
22 #define OSPF6_MESSAGE_H
23
24 #define OSPF6_MESSAGE_BUFSIZ 4096
25
26 /* Debug option */
27 extern unsigned char conf_debug_ospf6_message[];
28 #define OSPF6_ACTION_SEND 0x01
29 #define OSPF6_ACTION_RECV 0x02
30 #define OSPF6_DEBUG_MESSAGE_SEND 0x01
31 #define OSPF6_DEBUG_MESSAGE_RECV 0x02
32 #define OSPF6_DEBUG_MESSAGE_SEND_HDR 0x04
33 #define OSPF6_DEBUG_MESSAGE_RECV_HDR 0x08
34 #define OSPF6_DEBUG_MESSAGE_SEND_BOTH \
35 OSPF6_DEBUG_MESSAGE_SEND | OSPF6_DEBUG_MESSAGE_SEND_HDR
36 #define OSPF6_DEBUG_MESSAGE_RECV_BOTH \
37 OSPF6_DEBUG_MESSAGE_RECV | OSPF6_DEBUG_MESSAGE_RECV_HDR
38
39 #define OSPF6_DEBUG_MESSAGE_ON(type, level) \
40 (conf_debug_ospf6_message[type] |= (level))
41 #define OSPF6_DEBUG_MESSAGE_OFF(type, level) \
42 (conf_debug_ospf6_message[type] &= ~(level))
43
44 #define IS_OSPF6_DEBUG_MESSAGE(t, e) \
45 (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_RECV_HDR) \
46 ? (conf_debug_ospf6_message[t] \
47 & (OSPF6_DEBUG_MESSAGE_RECV_BOTH)) \
48 : (((OSPF6_DEBUG_MESSAGE_##e) == OSPF6_DEBUG_MESSAGE_SEND_HDR) \
49 ? (conf_debug_ospf6_message[t] \
50 & (OSPF6_DEBUG_MESSAGE_SEND_BOTH)) \
51 : (conf_debug_ospf6_message[t] \
52 & (OSPF6_DEBUG_MESSAGE_##e))))
53
54 #define IS_OSPF6_DEBUG_MESSAGE_ENABLED(type, e) \
55 (conf_debug_ospf6_message[type] & (OSPF6_DEBUG_MESSAGE_##e))
56
57 /* Type */
58 #define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0
59 #define OSPF6_MESSAGE_TYPE_HELLO 0x1 /* Discover/maintain neighbors */
60 #define OSPF6_MESSAGE_TYPE_DBDESC 0x2 /* Summarize database contents */
61 #define OSPF6_MESSAGE_TYPE_LSREQ 0x3 /* Database download request */
62 #define OSPF6_MESSAGE_TYPE_LSUPDATE 0x4 /* Database update */
63 #define OSPF6_MESSAGE_TYPE_LSACK 0x5 /* Flooding acknowledgment */
64 #define OSPF6_MESSAGE_TYPE_ALL 0x6 /* For debug option */
65
66 /* OSPFv3 packet header */
67 #define OSPF6_HEADER_SIZE 16U
68 struct ospf6_header {
69 uint8_t version;
70 uint8_t type;
71 uint16_t length;
72 in_addr_t router_id;
73 in_addr_t area_id;
74 uint16_t checksum;
75 uint8_t instance_id;
76 uint8_t reserved;
77 };
78
79 #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length))
80
81 /* Hello */
82 #define OSPF6_HELLO_MIN_SIZE 20U
83 struct ospf6_hello {
84 ifindex_t interface_id;
85 uint8_t priority;
86 uint8_t options[3];
87 uint16_t hello_interval;
88 uint16_t dead_interval;
89 in_addr_t drouter;
90 in_addr_t bdrouter;
91 /* Followed by Router-IDs */
92 };
93
94 /* Database Description */
95 #define OSPF6_DB_DESC_MIN_SIZE 12U
96 struct ospf6_dbdesc {
97 uint8_t reserved1;
98 uint8_t options[3];
99 uint16_t ifmtu;
100 uint8_t reserved2;
101 uint8_t bits;
102 uint32_t seqnum;
103 /* Followed by LSA Headers */
104 };
105
106 #define OSPF6_DBDESC_MSBIT (0x01) /* master/slave bit */
107 #define OSPF6_DBDESC_MBIT (0x02) /* more bit */
108 #define OSPF6_DBDESC_IBIT (0x04) /* initial bit */
109
110 /* Link State Request */
111 #define OSPF6_LS_REQ_MIN_SIZE 0U
112 /* It is just a sequence of entries below */
113 #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U
114 struct ospf6_lsreq_entry {
115 uint16_t reserved; /* Must Be Zero */
116 uint16_t type; /* LS type */
117 in_addr_t id; /* Link State ID */
118 in_addr_t adv_router; /* Advertising Router */
119 };
120
121 /* Link State Update */
122 #define OSPF6_LS_UPD_MIN_SIZE 4U
123 struct ospf6_lsupdate {
124 uint32_t lsa_number;
125 /* Followed by LSAs */
126 };
127
128 /* Link State Acknowledgement */
129 #define OSPF6_LS_ACK_MIN_SIZE 0U
130 /* It is just a sequence of LSA Headers */
131
132 /* Function definition */
133 extern void ospf6_hello_print(struct ospf6_header *, int action);
134 extern void ospf6_dbdesc_print(struct ospf6_header *, int action);
135 extern void ospf6_lsreq_print(struct ospf6_header *, int action);
136 extern void ospf6_lsupdate_print(struct ospf6_header *, int action);
137 extern void ospf6_lsack_print(struct ospf6_header *, int action);
138
139 extern int ospf6_iobuf_size(unsigned int size);
140 extern void ospf6_message_terminate(void);
141 extern int ospf6_receive(struct thread *thread);
142
143 extern int ospf6_hello_send(struct thread *thread);
144 extern int ospf6_dbdesc_send(struct thread *thread);
145 extern int ospf6_dbdesc_send_newone(struct thread *thread);
146 extern int ospf6_lsreq_send(struct thread *thread);
147 extern int ospf6_lsupdate_send_interface(struct thread *thread);
148 extern int ospf6_lsupdate_send_neighbor(struct thread *thread);
149 extern int ospf6_lsack_send_interface(struct thread *thread);
150 extern int ospf6_lsack_send_neighbor(struct thread *thread);
151
152 extern int config_write_ospf6_debug_message(struct vty *);
153 extern void install_element_ospf6_debug_message(void);
154
155 #endif /* OSPF6_MESSAGE_H */