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