]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_intra.h
Include padding in control message length.
[mirror_frr.git] / ospf6d / ospf6_intra.h
CommitLineData
718e3744 1/*
508e53e2 2 * Copyright (C) 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_INTRA_H
23#define OSPF6_INTRA_H
24
508e53e2 25/* Router-LSA */
26struct ospf6_router_lsa
27{
28 u_char bits;
29 u_char options[3];
30 /* followed by ospf6_router_lsdesc(s) */
31};
32
33/* Link State Description in Router-LSA */
34struct ospf6_router_lsdesc
35{
36 u_char type;
37 u_char reserved;
38 u_int16_t metric; /* output cost */
39 u_int32_t interface_id;
40 u_int32_t neighbor_interface_id;
41 u_int32_t neighbor_router_id;
42};
43
44#define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
45#define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
46#define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
47#define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
48
49#define ROUTER_LSDESC_IS_TYPE(t,x) \
50 ((((struct ospf6_router_lsdesc *)(x))->type == \
51 OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
52#define ROUTER_LSDESC_GET_METRIC(x) \
53 (ntohs (((struct ospf6_router_lsdesc *)(x))->metric))
54#define ROUTER_LSDESC_GET_IFID(x) \
55 (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id))
56#define ROUTER_LSDESC_GET_NBR_IFID(x) \
57 (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
58#define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
59 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
60
61/* Network-LSA */
62struct ospf6_network_lsa
63{
64 u_char reserved;
65 u_char options[3];
66 /* followed by ospf6_netowrk_lsd(s) */
67};
68
69/* Link State Description in Router-LSA */
70struct ospf6_network_lsdesc
71{
72 u_int32_t router_id;
73};
74#define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
75 (((struct ospf6_network_lsdesc *)(x))->router_id)
76
77/* Link-LSA */
78struct ospf6_link_lsa
79{
80 u_char priority;
81 u_char options[3];
82 struct in6_addr linklocal_addr;
83 u_int32_t prefix_num;
84 /* followed by ospf6 prefix(es) */
85};
86
87/* Intra-Area-Prefix-LSA */
88struct ospf6_intra_prefix_lsa
89{
90 u_int16_t prefix_num;
91 u_int16_t ref_type;
92 u_int32_t ref_id;
93 u_int32_t ref_adv_router;
94 /* followed by ospf6 prefix(es) */
95};
96
97\f
98#define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
99 do { \
100 if (! (oa)->thread_router_lsa) \
101 (oa)->thread_router_lsa = \
102 thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \
103 } while (0)
104#define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
105 do { \
106 if (! (oi)->thread_network_lsa) \
107 (oi)->thread_network_lsa = \
108 thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \
109 } while (0)
110#define OSPF6_LINK_LSA_SCHEDULE(oi) \
111 do { \
112 if (! (oi)->thread_link_lsa) \
113 (oi)->thread_link_lsa = \
114 thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \
115 } while (0)
116#define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
117 do { \
118 if (! (oa)->thread_intra_prefix_lsa) \
119 (oa)->thread_intra_prefix_lsa = \
120 thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
121 oa, 0); \
122 } while (0)
123#define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
124 do { \
125 if (! (oi)->thread_intra_prefix_lsa) \
126 (oi)->thread_intra_prefix_lsa = \
127 thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
128 oi, 0); \
129 } while (0)
130
131/* Function Prototypes */
132char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id,
133 u_int32_t neighbor_interface_id,
134 u_int32_t neighbor_router_id,
135 struct ospf6_lsa *lsa);
136char *ospf6_network_lsdesc_lookup (u_int32_t router_id,
137 struct ospf6_lsa *lsa);
138
139int ospf6_router_lsa_originate (struct thread *);
140int ospf6_network_lsa_originate (struct thread *);
141int ospf6_link_lsa_originate (struct thread *);
142int ospf6_intra_prefix_lsa_originate_transit (struct thread *);
143int ospf6_intra_prefix_lsa_originate_stub (struct thread *);
144void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa);
145void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa);
146
147void ospf6_intra_route_calculation (struct ospf6_area *oa);
148void ospf6_intra_asbr_calculation (struct ospf6_area *oa);
718e3744 149
150void ospf6_intra_init ();
151
508e53e2 152#endif /* OSPF6_LSA_H */
718e3744 153