]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
508e53e2 | 2 | * Copyright (C) 1999-2003 Yasuhiro Ohara |
718e3744 | 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 | * | |
896014f4 DL |
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 | |
718e3744 | 19 | */ |
20 | ||
21 | #ifndef OSPF6_MESSAGE_H | |
22 | #define OSPF6_MESSAGE_H | |
23 | ||
508e53e2 | 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 | |
d62a17ae | 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) | |
718e3744 | 36 | |
37 | /* Type */ | |
718e3744 | 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 */ | |
508e53e2 | 41 | #define OSPF6_MESSAGE_TYPE_LSREQ 0x3 /* Database download request */ |
718e3744 | 42 | #define OSPF6_MESSAGE_TYPE_LSUPDATE 0x4 /* Database update */ |
43 | #define OSPF6_MESSAGE_TYPE_LSACK 0x5 /* Flooding acknowledgment */ | |
508e53e2 | 44 | #define OSPF6_MESSAGE_TYPE_ALL 0x6 /* For debug option */ |
45 | ||
718e3744 | 46 | /* OSPFv3 packet header */ |
abc7ef44 | 47 | #define OSPF6_HEADER_SIZE 16U |
d62a17ae | 48 | struct ospf6_header { |
d7c0a89a QY |
49 | uint8_t version; |
50 | uint8_t type; | |
51 | uint16_t length; | |
858f9c08 DL |
52 | in_addr_t router_id; |
53 | in_addr_t area_id; | |
d7c0a89a QY |
54 | uint16_t checksum; |
55 | uint8_t instance_id; | |
56 | uint8_t reserved; | |
718e3744 | 57 | }; |
58 | ||
508e53e2 | 59 | #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length)) |
60 | ||
718e3744 | 61 | /* Hello */ |
abc7ef44 | 62 | #define OSPF6_HELLO_MIN_SIZE 20U |
d62a17ae | 63 | struct ospf6_hello { |
64 | ifindex_t interface_id; | |
d7c0a89a QY |
65 | uint8_t priority; |
66 | uint8_t options[3]; | |
67 | uint16_t hello_interval; | |
68 | uint16_t dead_interval; | |
858f9c08 DL |
69 | in_addr_t drouter; |
70 | in_addr_t bdrouter; | |
d62a17ae | 71 | /* Followed by Router-IDs */ |
718e3744 | 72 | }; |
73 | ||
74 | /* Database Description */ | |
abc7ef44 | 75 | #define OSPF6_DB_DESC_MIN_SIZE 12U |
d62a17ae | 76 | struct ospf6_dbdesc { |
d7c0a89a QY |
77 | uint8_t reserved1; |
78 | uint8_t options[3]; | |
79 | uint16_t ifmtu; | |
80 | uint8_t reserved2; | |
81 | uint8_t bits; | |
82 | uint32_t seqnum; | |
d62a17ae | 83 | /* Followed by LSA Headers */ |
718e3744 | 84 | }; |
508e53e2 | 85 | |
86 | #define OSPF6_DBDESC_MSBIT (0x01) /* master/slave bit */ | |
87 | #define OSPF6_DBDESC_MBIT (0x02) /* more bit */ | |
88 | #define OSPF6_DBDESC_IBIT (0x04) /* initial bit */ | |
718e3744 | 89 | |
90 | /* Link State Request */ | |
abc7ef44 | 91 | #define OSPF6_LS_REQ_MIN_SIZE 0U |
508e53e2 | 92 | /* It is just a sequence of entries below */ |
abc7ef44 | 93 | #define OSPF6_LSREQ_LSDESC_FIX_SIZE 12U |
d62a17ae | 94 | struct ospf6_lsreq_entry { |
d7c0a89a QY |
95 | uint16_t reserved; /* Must Be Zero */ |
96 | uint16_t type; /* LS type */ | |
858f9c08 DL |
97 | in_addr_t id; /* Link State ID */ |
98 | in_addr_t adv_router; /* Advertising Router */ | |
718e3744 | 99 | }; |
100 | ||
101 | /* Link State Update */ | |
abc7ef44 | 102 | #define OSPF6_LS_UPD_MIN_SIZE 4U |
d62a17ae | 103 | struct ospf6_lsupdate { |
d7c0a89a | 104 | uint32_t lsa_number; |
d62a17ae | 105 | /* Followed by LSAs */ |
718e3744 | 106 | }; |
107 | ||
108 | /* Link State Acknowledgement */ | |
abc7ef44 | 109 | #define OSPF6_LS_ACK_MIN_SIZE 0U |
508e53e2 | 110 | /* It is just a sequence of LSA Headers */ |
111 | ||
112 | /* Function definition */ | |
d62a17ae | 113 | extern void ospf6_hello_print(struct ospf6_header *); |
114 | extern void ospf6_dbdesc_print(struct ospf6_header *); | |
115 | extern void ospf6_lsreq_print(struct ospf6_header *); | |
116 | extern void ospf6_lsupdate_print(struct ospf6_header *); | |
117 | extern void ospf6_lsack_print(struct ospf6_header *); | |
118 | ||
119 | extern int ospf6_iobuf_size(unsigned int size); | |
120 | extern void ospf6_message_terminate(void); | |
121 | extern int ospf6_receive(struct thread *thread); | |
122 | ||
123 | extern int ospf6_hello_send(struct thread *thread); | |
124 | extern int ospf6_dbdesc_send(struct thread *thread); | |
125 | extern int ospf6_dbdesc_send_newone(struct thread *thread); | |
126 | extern int ospf6_lsreq_send(struct thread *thread); | |
127 | extern int ospf6_lsupdate_send_interface(struct thread *thread); | |
128 | extern int ospf6_lsupdate_send_neighbor(struct thread *thread); | |
129 | extern int ospf6_lsack_send_interface(struct thread *thread); | |
130 | extern int ospf6_lsack_send_neighbor(struct thread *thread); | |
131 | ||
132 | extern int config_write_ospf6_debug_message(struct vty *); | |
133 | extern void install_element_ospf6_debug_message(void); | |
718e3744 | 134 | |
135 | #endif /* OSPF6_MESSAGE_H */ |