]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_ri.h
Merge branch 'master' into stylechecker
[mirror_frr.git] / ospfd / ospf_ri.h
1 /*
2 * This is an implementation of RFC4970 Router Information
3 * with support of RFC5088 PCE Capabilites announcement
4 * and support of draft-ietf-ospf-segment-routing-extensions-18
5 * for Segment Routing Capabilities announcement
6 *
7 *
8 * Module name: Router Information
9 * Author: Olivier Dugeon <olivier.dugeon@orange.com>
10 * Copyright (C) 2012 - 2017 Orange Labs http://www.orange.com/
11 *
12 * This file is part of GNU Zebra.
13 *
14 * GNU Zebra is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the
16 * Free Software Foundation; either version 2, or (at your option) any
17 * later version.
18 *
19 * GNU Zebra is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; see the file COPYING; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 #ifndef _ZEBRA_OSPF_ROUTER_INFO_H
30 #define _ZEBRA_OSPF_ROUTER_INFO_H
31
32 /*
33 * Opaque LSA's link state ID for Router Information is
34 * structured as follows.
35 *
36 * 24 16 8 0
37 * +--------+--------+--------+--------+
38 * | 4 | MBZ |........|........|
39 * +--------+--------+--------+--------+
40 * |<-Type->|<Resv'd>|<-- Instance --->|
41 *
42 *
43 * Type: IANA has assigned '4' for Router Information.
44 * MBZ: Reserved, must be set to zero.
45 * Instance: User may select an arbitrary 16-bit value.
46 *
47 */
48
49 /*
50 * 24 16 8 0
51 * +--------+--------+--------+--------+ ---
52 * | LS age |Options | 9,10,11| A
53 * +--------+--------+--------+--------+ |
54 * | 4 | 0 | Instance | |
55 * +--------+--------+--------+--------+ |
56 * | Advertising router | | Standard (Opaque) LSA header;
57 * +--------+--------+--------+--------+ | Type 9,10 or 11 are used.
58 * | LS sequence number | |
59 * +--------+--------+--------+--------+ |
60 * | LS checksum | Length | V
61 * +--------+--------+--------+--------+ ---
62 * | Type | Length | A TLV part for Router Information;
63 * +--------+--------+--------+--------+ | Values might be
64 * | Values ... | V structured as a set of sub-TLVs.
65 * +--------+--------+--------+--------+ ---
66 */
67
68 /*
69 * Following section defines TLV body parts.
70 */
71
72 /* Up to now, 11 code points have been assigned to Router Information */
73 /* Only type 1 Router Capabilities and 6 PCE are supported with this code */
74 #define RI_IANA_MAX_TYPE 11
75
76 /* RFC4970: Router Information Capabilities TLV */ /* Mandatory */
77 #define RI_TLV_CAPABILITIES 1
78
79 struct ri_tlv_router_cap {
80 struct tlv_header header; /* Value length is 4 bytes. */
81 u_int32_t value;
82 };
83
84 /* Capabilities bits are left align */
85 #define RI_GRACE_RESTART 0x80000000
86 #define RI_GRACE_HELPER 0x40000000
87 #define RI_STUB_SUPPORT 0x20000000
88 #define RI_TE_SUPPORT 0x10000000
89 #define RI_P2P_OVER_LAN 0x08000000
90 #define RI_TE_EXPERIMENTAL 0x04000000
91
92 #define RI_TLV_LENGTH 4
93
94 /* RFC5088: PCE Capabilities TLV */ /* Optional */
95 /* RI PCE TLV */
96 #define RI_TLV_PCE 6
97
98 struct ri_tlv_pce {
99 struct tlv_header header;
100 /* A set of PCE-sub-TLVs will follow. */
101 };
102
103 /* PCE Address Sub-TLV */ /* Mandatory */
104 #define RI_PCE_SUBTLV_ADDRESS 1
105 struct ri_pce_subtlv_address {
106 /* Type = 1; Length is 8 (IPv4) or 20 (IPv6) bytes. */
107 struct tlv_header header;
108 #define PCE_ADDRESS_LENGTH_IPV4 8
109 #define PCE_ADDRESS_LENGTH_IPV6 20
110 struct {
111 u_int16_t type; /* Address type: 1 = IPv4, 2 = IPv6 */
112 #define PCE_ADDRESS_TYPE_IPV4 1
113 #define PCE_ADDRESS_TYPE_IPV6 2
114 u_int16_t reserved;
115 struct in_addr value; /* PCE address */
116 } address;
117 };
118
119 /* PCE Path-Scope Sub-TLV */ /* Mandatory */
120 #define RI_PCE_SUBTLV_PATH_SCOPE 2
121 struct ri_pce_subtlv_path_scope {
122 struct tlv_header header; /* Type = 2; Length = 4 bytes. */
123 /*
124 * L, R, Rd, S, Sd, Y, PrefL, PrefR, PrefS and PrefY bits:
125 * see RFC5088 page 9
126 */
127 u_int32_t value;
128 };
129
130 /* PCE Domain Sub-TLV */ /* Optional */
131 #define RI_PCE_SUBTLV_DOMAIN 3
132
133 #define PCE_DOMAIN_TYPE_AREA 1
134 #define PCE_DOMAIN_TYPE_AS 2
135
136 struct ri_pce_subtlv_domain {
137 struct tlv_header header; /* Type = 3; Length = 8 bytes. */
138 u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
139 u_int16_t reserved;
140 u_int32_t value;
141 };
142
143 /* PCE Neighbor Sub-TLV */ /* Mandatory if R or S bit is set */
144 #define RI_PCE_SUBTLV_NEIGHBOR 4
145 struct ri_pce_subtlv_neighbor {
146 struct tlv_header header; /* Type = 4; Length = 8 bytes. */
147 u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */
148 u_int16_t reserved;
149 u_int32_t value;
150 };
151
152 /* PCE Capabilities Flags Sub-TLV */ /* Optional */
153 #define RI_PCE_SUBTLV_CAP_FLAG 5
154
155 #define PCE_CAP_GMPLS_LINK 0x0001
156 #define PCE_CAP_BIDIRECTIONAL 0x0002
157 #define PCE_CAP_DIVERSE_PATH 0x0004
158 #define PCE_CAP_LOAD_BALANCE 0x0008
159 #define PCE_CAP_SYNCHRONIZED 0x0010
160 #define PCE_CAP_OBJECTIVES 0x0020
161 #define PCE_CAP_ADDITIVE 0x0040
162 #define PCE_CAP_PRIORIZATION 0x0080
163 #define PCE_CAP_MULTIPLE_REQ 0x0100
164
165 struct ri_pce_subtlv_cap_flag {
166 struct tlv_header header; /* Type = 5; Length = n x 4 bytes. */
167 u_int32_t value;
168 };
169
170 /* Structure to share flooding scope info for Segment Routing */
171 struct scope_info {
172 uint8_t scope;
173 struct in_addr area_id;
174 };
175
176 /* Prototypes. */
177 extern int ospf_router_info_init(void);
178 extern void ospf_router_info_term(void);
179 extern void ospf_router_info_finish(void);
180 extern int ospf_router_info_enable(void);
181 extern void ospf_router_info_update_sr(bool enable, struct sr_srgb srgb,
182 uint8_t msd);
183 extern struct scope_info ospf_router_info_get_flooding_scope(void);
184 #endif /* _ZEBRA_OSPF_ROUTER_INFO_H */