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