]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_ri.h
50221b25c59c17b7a2e14db612fe7ed1119f6585
2 * This is an implementation of RFC4970 Router Information
3 * with support of RFC5088 PCE Capabilites announcement
5 * Module name: Router Information
7 * Created: 2012-02-01 by Olivier Dugeon
8 * Copyright (C) 2012 Orange Labs http://www.orange.com/
10 * This file is part of GNU Zebra.
12 * GNU Zebra is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2, or (at your option) any
17 * GNU Zebra is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; see the file COPYING; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #ifndef _ZEBRA_OSPF_ROUTER_INFO_H
28 #define _ZEBRA_OSPF_ROUTER_INFO_H
31 * Opaque LSA's link state ID for Router Information is
32 * structured as follows.
35 * +--------+--------+--------+--------+
36 * | 1 | MBZ |........|........|
37 * +--------+--------+--------+--------+
38 * |<-Type->|<Resv'd>|<-- Instance --->|
41 * Type: IANA has assigned '4' for Router Information.
42 * MBZ: Reserved, must be set to zero.
43 * Instance: User may select an arbitrary 16-bit value.
49 * +--------+--------+--------+--------+ ---
50 * | LS age |Options | 9,10,11| A
51 * +--------+--------+--------+--------+ |
52 * | 4 | 0 | Instance | |
53 * +--------+--------+--------+--------+ |
54 * | Advertising router | | Standard (Opaque) LSA header;
55 * +--------+--------+--------+--------+ | Type 9,10 or 11 are used.
56 * | LS sequence number | |
57 * +--------+--------+--------+--------+ |
58 * | LS checksum | Length | V
59 * +--------+--------+--------+--------+ ---
61 * +--------+--------+--------+--------+ | TLV part for Router Information;
63 * | Values ... | V structured as a set of sub-TLVs.
64 * +--------+--------+--------+--------+ ---
68 * Following section defines TLV (tag, length, value) structures,
69 * used for Router Information.
71 struct ri_tlv_header
{
72 u_int16_t type
; /* RI_TLV_XXX (see below) */
73 u_int16_t length
; /* Value portion only, in byte */
76 #define RI_TLV_HDR_SIZE (sizeof (struct ri_tlv_header))
77 #define RI_TLV_BODY_SIZE(tlvh) (ROUNDUP (ntohs ((tlvh)->length), sizeof (u_int32_t)))
78 #define RI_TLV_SIZE(tlvh) (RI_TLV_HDR_SIZE + RI_TLV_BODY_SIZE(tlvh))
79 #define RI_TLV_HDR_TOP(lsah) (struct ri_tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE)
80 #define RI_TLV_HDR_NEXT(tlvh) (struct ri_tlv_header *)((char *)(tlvh) + RI_TLV_SIZE(tlvh))
83 * Following section defines TLV body parts.
86 /* Up to now, 8 code point have been assigned to Router Information */
87 /* Only type 1 Router Capabilities and 6 PCE are supported with this code */
88 #define RI_IANA_MAX_TYPE 8
90 /* RFC4970: Router Information Capabilities TLV */ /* Mandatory */
91 #define RI_TLV_CAPABILITIES 1
93 struct ri_tlv_router_cap
{
94 struct ri_tlv_header header
; /* Value length is 4 bytes. */
98 #define RI_GRACE_RESTART 0x01
99 #define RI_GRACE_HELPER 0x02
100 #define RI_STUB_SUPPORT 0x04
101 #define RI_TE_SUPPORT 0x08
102 #define RI_P2P_OVER_LAN 0x10
103 #define RI_TE_EXPERIMENTAL 0x20
105 #define RI_TLV_LENGTH 4
107 /* RFC5088: PCE Capabilities TLV */ /* Optional */
112 struct ri_tlv_header header
;
113 /* A set of PCE-sub-TLVs will follow. */
116 /* PCE Address Sub-TLV */ /* Mandatory */
117 #define RI_PCE_SUBTLV_ADDRESS 1
118 struct ri_pce_subtlv_address
{
120 header
; /* Type = 1; Length is 8 (IPv4) or 20 (IPv6) bytes. */
122 /* clang-format off */
123 #define PCE_ADDRESS_LENGTH_IPV4 8
124 #define PCE_ADDRESS_LENGTH_IPV6 20
126 u_int16_t type
; /* Address type: 1 = IPv4, 2 = IPv6 */
128 /* clang-format off */
129 #define PCE_ADDRESS_TYPE_IPV4 1
130 #define PCE_ADDRESS_TYPE_IPV6 2
132 struct in_addr value
; /* PCE address */
136 /* PCE Path-Scope Sub-TLV */ /* Mandatory */
137 #define RI_PCE_SUBTLV_PATH_SCOPE 2
138 struct ri_pce_subtlv_path_scope
{
139 struct ri_tlv_header header
; /* Type = 2; Length = 4 bytes. */
140 u_int32_t value
; /* L, R, Rd, S, Sd, Y, PrefL, PrefR, PrefS and PrefY
141 bits see RFC5088 page 9 */
144 /* PCE Domain Sub-TLV */ /* Optional */
145 #define RI_PCE_SUBTLV_DOMAIN 3
147 #define PCE_DOMAIN_TYPE_AREA 1
148 #define PCE_DOMAIN_TYPE_AS 2
150 struct ri_pce_subtlv_domain
{
151 struct ri_tlv_header header
; /* Type = 3; Length = 8 bytes. */
152 u_int16_t type
; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
157 /* PCE Neighbor Sub-TLV */ /* Mandatory if R or S bit is set */
158 #define RI_PCE_SUBTLV_NEIGHBOR 4
159 struct ri_pce_subtlv_neighbor
{
160 struct ri_tlv_header header
; /* Type = 4; Length = 8 bytes. */
161 u_int16_t type
; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
166 /* PCE Capabilities Flags Sub-TLV */ /* Optional */
167 #define RI_PCE_SUBTLV_CAP_FLAG 5
169 #define PCE_CAP_GMPLS_LINK 0x0001
170 #define PCE_CAP_BIDIRECTIONAL 0x0002
171 #define PCE_CAP_DIVERSE_PATH 0x0004
172 #define PCE_CAP_LOAD_BALANCE 0x0008
173 #define PCE_CAP_SYNCHRONIZED 0x0010
174 #define PCE_CAP_OBJECTIVES 0x0020
175 #define PCE_CAP_ADDITIVE 0x0040
176 #define PCE_CAP_PRIORIZATION 0x0080
177 #define PCE_CAP_MULTIPLE_REQ 0x0100
179 struct ri_pce_subtlv_cap_flag
{
180 struct ri_tlv_header header
; /* Type = 5; Length = n x 4 bytes. */
185 extern int ospf_router_info_init(void);
186 extern void ospf_router_info_term(void);
188 #endif /* _ZEBRA_OSPF_ROUTER_INFO_H */